> daniel kessler wrote:
> SELECT n.meeting_name,n.type,n.note_date,n.notes,n.type_describe
> FROM notes_to_the_record n
> WHERE n.ID = #session.user.id# OR
> n.n_r_id IN (SELECT n_r_id FROM notes_to_the_record_shared WHERE id =  
> #session.user.id#)
> 
> No DISTINCT necessary.

yknow, I didn't read this far at first.  I was about to take my daughter out to 
the bus and tried to get the dump you requested done as soon as possible.  I 
came back and re-read it, trying to figure things out.

IT WORKED!

Now, since it's a search tool, I had to add another set of ANDs for all the 
search parameters.  I came up with something, after much ta-doo and I think 
it's right, but I was hoping that y'all could check it over - mainly how I 
organized the search variables with the query that was provided.  I also added 
parens around the WHERE content that was provided.  This seems to work with 
initial testing.

SELECT n.meeting_name,n.type,n.note_date,n.notes,n.type_describe
FROM notes_to_the_record n
WHERE 
     (1=1
     <cfif url.meeting_name neq "">
     AND UPPER(n.meeting_name) LIKE <cfqueryparam 
value="%#UCase(url.meeting_name)#%" cfsqltype="cf_sql_varchar">
     </cfif>
     <cfif url.type neq "">
     #url.and_or_1# UPPER(n.type) LIKE <cfqueryparam 
value="%#UCase(url.type)#%" cfsqltype="cf_sql_varchar"> 
     </cfif>
     <cfif url.notes neq "">
     #url.and_or_2# UPPER(n.notes) LIKE <cfqueryparam 
value="%#UCase(url.notes)#%" cfsqltype="cf_sql_varchar"> 
     </cfif>
     )
                        
     AND
     (n.ID = #session.user.id# OR n.n_r_id IN 
          (
          SELECT n_r_id FROM notes_to_the_record_shared WHERE id = 
#session.user.id#
          )
     )
     ORDER BY UPPER(n.meeting_name) ASC
 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267813
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to