Hi, all...

I can't figure out how to use the cfif statements
in the query below.  Everywhere I put them I get a syntax
error.  DB is MySQL 5.

Suggestions, anyone?

Thanks,

Rick


<cfquery name='get_properties' datasource='#dsn#' 
cachedWithin='#CreateTimeSpan(0,0,0,0)#'>
                        
     select properties.property_id, properties.mls_number, 
properties.street_number,
properties.street_name,
            properties.city, properties.state, properties.remarks, 
properties.property_type,
properties.list_price,
            properties.listing_office_mls_id, offices.mls, offices.office_name,
offices.display_order, offices.mls_office_id,
            min( property_photos.photo_filename) as prop_photo_filename
       from properties
      where 1=1
        
        <cfif session.lots_land is '1'>
        and properties.property_type = 'lots and land'
        </cfif>
                           
        <cfif session.commercial is '1'>
         or properties.property_type = 'commercial'
        </cfif>
                           
        <cfif session.multifamily is '1'>
         or properties.property_type = 'multifamily'
        </cfif>
                           
        <cfif session.residential is '1'>
         or properties.property_type = 'residential'
        </cfif>
        
  left join property_photos

         on substring_index(properties.mls_number, '_', 1) = 
property_photos.photo_mls_number
        and properties.mls = property_photos.mls

  left join offices
         on properties.listing_office_mls_id = offices.mls_office_id
        and properties.mls = offices.mls           
   group by properties.mls_number
   order by offices.display_order
                  
</cfquery>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305995
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