• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

List into Query?

LEGEND ,
Nov 20, 2006 Nov 20, 2006

Copy link to clipboard

Copied

This should be simple, but I can't wrap my head around it.

A user inputs their zip code into a page. A list of nearby zip codes is
returned from the database, separated by commas. No problem, that part's
done.

I want to take that list of zip codes and blend it with the next query that
takes place.

The current query takes two search criteria and returns results from the
database. But I want to tell the query that each record returned from the
database must contain one of the zip codes in the list that was just
generated. I'm using MySQL if it matters.

--
Bill



TOPICS
Advanced techniques

Views

198

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 20, 2006 Nov 20, 2006

Copy link to clipboard

Copied

Try a where in clause ..

WHERE ZipCode IN (
<cfqueryparam cfsqltype="cf_sql_varchar" value="#ListOfZipCodes#" list="yes">
)
AND
.... other conditions.....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 20, 2006 Nov 20, 2006

Copy link to clipboard

Copied

LATEST
"cf_dev2" <webforumsuser@macromedia.com> wrote in message
news:eju47d$bkq$1@forums.macromedia.com...
> Try a where in clause ..
>
> WHERE ZipCode IN (
> <cfqueryparam cfsqltype="cf_sql_varchar" value="#ListOfZipCodes#"
> list="yes">
> )
> AND
> .... other conditions.....



That worked perfectly. Thanks!





Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation