You could try the UNION operator. (SQL 6.5, not sure what other DB's
support)

<cfquery name="options" datasource="mydatasource" dbtype="ODBC">
select state,city from attractions
union
select state,city from properties
order by state
</cfquery>

this will remove dupe rows.  (Note: the select list columns must be the same
datatype)

Brian D. Horn
Society of Financial Service Professionals
Information Systems Group
610-526-2500
mailto:[EMAIL PROTECTED]
> -----Original Message-----
> From: Michael Blair [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, May 09, 2000 11: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=lists/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