Use UNION.

<cfquery name="options" datasource="mydatasource" dbtype="ODBC">
      Select DISTINCT state, city
      From  attractions
      Order by state
                UNION
        Select DISTINCT state, city
      From  properties
      Order by state
</cfquery>

The exact syntax of your queries may differ, but that's the path you want to
take...

> -----Original Message-----
> From: Michael Blair [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 09, 2000 8:52 AM
> To: [EMAIL PROTECTED]
> Subject: Querying 2 tables with the same conditions
> 
> 
> How can I query 2 different tables using the same criteria.  
> I want to have
> one query that grabs all the information as below
> 
> 
> <cfquery name="options" datasource="mydatasource" dbtype="ODBC">
>      Select DISTINCT state, city
>      From  attractions, properties
>      Order by state
> </cfquery>
> 
> Basically I only want unique city and states from the attractions and
> properties database.
> 
> What is the best way to do this.
> 
> TIA!
> 
> --------------------------------------------------------------
> ----------------
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit 
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=list
s/cf_talk or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to