FYI - he's write about the 0 = 0, it's useless to have that with your 
or's...the or's aren't even being evaluated and ultimately, it's going to keep 
you from getting the right data.

Glad you got the count to work though. :)

Dave

-----Original Message-----
From: Protoculture [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 11:39 AM
To: CF-Talk
Subject: Re: SQL Count Question...


thanks RADEMAKERS, that did it... here is the working code..

            SELECT COUNT(DISTINCT(opportunity.id))
                                                        
                        FROM            opportunity,
                                                advertiser,
                                                location
                        
                        WHERE           opportunity.deleted                     
=               'N'                                                             
                AND
                                                opportunity.authorised          
=               'Y'                                                             
                AND
                                                opportunity.active              
        =               'Y'                                                     
                        AND
                                                opportunity.activate            
<=              getdate()                                                       
        AND
                                                opportunity.deactivate          
>=              getdate()                                                       
        AND
                                                opportunity.advertiser_id       
=               advertiser.id                                                   
AND
                                                advertiser.deleted              
        =               'N'                                                     
                        AND
                                                advertiser.suspended            
=               'N'                                                             
                AND
                                                
                        ( 
                            (0 = 0      OR levels       LIKE '%' + ',' + 
CONVERT(VARCHAR,0) + ',' + '%') OR
                            (0 = 0      OR levels       LIKE '%' + ',' + 
CONVERT(VARCHAR,0) + ',' + '%')
                        ) AND
                                                 
                            (0  = 0     OR sectors      LIKE '%' + ',' + 
CONVERT(VARCHAR,0) + ',' + '%')        AND
                            (0  = 0     OR work_types   LIKE '%' + ',' + 
CONVERT(VARCHAR,0) + ',' + '%')        
                            
                          AND
                                                 
                         (
                            0   = 0     OR 
                            (0  LIKE '%' + ',' + CONVERT(VARCHAR,0) + ',' + '%' 
AND
                                0   LIKE        '%' + ',' + CONVERT(VARCHAR,0) 
+ ',' + '%')
                          )



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216500
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to