macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Re: combine queries

Subject: Re: combine queries
From: "BKBK"
Date: Wed, 8 Aug 2007 05:27:59 +0000 UTC
Newsgroups: macromedia.coldfusion.cfml_general_discussion
Splitzer wrote:
 [i]I tried the query again, but the query shows repeated results. The data is 
being repeated upto 3-4 times. I think what its doing its actually joining 
similar columns. [/i]

 I don't think so. I now think there is a simpler explanation. You are probably 
not using [i]myID[/i]  as a primary key, and have more than one row containing 
the same value. Looks like there is a mistake on my side, too. I should have 
specified the list of columns by name. 

 Let's have another go. I am still assuming that [i]myID[/i]  is a primary key. 
Then the queries Notes_get and Favorite_sites would each return at most one 
row. The data in Notes_get's row, if any, would correspond to the data in 
Favorite_sites' row, if there is any. The following query will therefore return 
one row, at most. Use the actual column names in place of columnA1, columnB1, 
and so on.

 <cfquery name="uniqueQuery" dbtype="query">
 SELECT notes_get.myID, notes_get.columnA1, notes_get.columnA2, 
favorite_sites.columnB1, favorite_sites.columnB2 
 FROM notes_get, favorite_sites
 </cfquery>




<Prev in Thread] Current Thread [Next in Thread>