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

Re: combine queries

Subject: Re: combine queries
From: "splitzer"
Date: Mon, 6 Aug 2007 01:28:27 +0000 UTC
Newsgroups: macromedia.coldfusion.cfml_general_discussion
[q][i]Originally posted by: [b][b]BKBK[/b][/b][/i]
 I am ignoring cachedWithin because it seems to be redundant in your code. I am 
also assuming that myID is a key, and so is unique. Then one can combine Query 
One and Query Two thus

 <cfquery name="uniqueQuery" dbtype="query">
 SELECT *
 FROM favorite_sites, notes_get
 </cfquery>

 [/q]

 I know this method, but what i'm really trying to do is filter the results 
too. Thats why i was trying WHERE db_new.notes.myID = 2 OR 
db_new.favorite_sites.myID = 2, but that didnt work, since its actually joining 
the queries instead of filtering it. 

 sorry, i couldnt find this thread. 

 Let me make couple of things clear. 

 -The column myID is not unique
 -unique column is "id"
 -since myID is not unique, it contains multiple values that i'm trying to 
filter. In this case, "2", so all the results containing 2 should come up 
instead of repeating it again and again through join query. 

 Why i'm trying to do this?:
 Well, i have pages that are reaching around 13-15 queries. That is one page 
only, someone suggested that i should combine the queries as much as i can. 
But, for some reason i cant get it to work. So, if i can probably reduce it to 
6-7 queries, it will reduce the execution time. 





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