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)
+ ',' + '%')
)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216497 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

