[thelist] OT -- toronto holiday get-together

rudy Rudy_Limeback at maritimelife.ca
Mon Dec 11 12:20:41 CST 2000


toronto evolt holiday get-together wednesday night 8 p.m. -- 
for details, see below


<tip type="conditional sql">
when generating exclusive WHERE conditions, avoid needless if/else testing 
by starting the WHERE clause with something guaranteed to be true --

     select foo from yourTable
        where 1=1

if no additional conditions are needed, i.e. selected by the user (imagine 
this query being dynamically tailored by user choices on a search form), 
then the above query returns the entire table

but when additional exclusive conditions are selected, you don't have to 
bother testing each one (to see if it's the first one which would've 
otherwise had to start with the WHERE keyword)

just generate each one with an AND keyword, tacking it on to the query so 
far --

     select foo from yourTable
        where 1=1
   <cfif userField1Checked>
           and dbColumn1 = '<cfoutput>#userField1Value#</cfoutput>'
    </cfif>
   <cfif userField2Checked>
           and dbColumn2 = '<cfoutput>#userField2Value#</cfoutput>'
    </cfif>

of course, if you are doing inclusive selection, you'll be generating OR 
conditions, in which case you want the WHERE clause to start with 
something NOT true

     select foo from yourTable
        where 1=0
   <cfif userFieldChecked>
           or dbColumn = '<cfoutput>#userFieldValue#</cfoutput>'
    </cfif>

</tip>



==================================
EVOLT TORONTO HOLIDAY GET-TOGETHER
==================================

WEDNESDAY DECEMBER 13   8:00 PM

C'EST WHAT, 67 FRONT ST E. (CORNER OF CHURCH)

http://toronto.com/E/V/TORON/0011/99/14/1.html

there are no reservations, so in order to find us, start at the bar (you 
won't have to go far) and look for the grey-haired guy in these photos --

   http://rudy.ca/codefest2.html






More information about the thelist mailing list