>>>except the WHERE clauses come from the CompassQueries table for all rows that match the campaign.
>>>
>>>How do I do this?
>>
>>
>>You will need dynamic SQL here, e.g.
>>
>>declare @SQL nvarchar(max)
>>
>>select @SQL = coalesce(@SQL + '
>>UNION ALL ','') + 'SELECT VoterID from tblCamp_CT WHERE '
>>+ Query FROM CompassQueries
>>
>>print @SQL
>>
>>execute (@SQL)
>
>Ok, I see what you're doing, excelt what's "Query"?
Query is a field in the CompassQueries table.
If it's not broken, fix it until it is.
My Blog