<<
SET VAR vWhereClause = +
('Control# LIKE'&.vSearchString&'OR ' + +
'DistName LIKE'&.vSearchString&'OR ' + +
'ShipState LIKE'&.vSearchString)
Could you show me exactly how you would use a UNION to do that? I can't figure
out the syntax.
>>
Something like this:
SELECT Col1, Col2, Col3, Control#, DistName, ShipState FROM TableName WHERE
Control# LIKE 'Thing%' +
UNION +
SELECT Col1, Col2, Col3, Control#, DistName, ShipState FROM TableName WHERE
DistName LIKE 'Thing%' +
UNION +
SELECT Col1, Col2, Col3, Control#, DistName, ShipState FROM TableName WHERE
ShipState LIKE 'Thing%'
Assuming that Control#, DistName, and ShipState are all indexed, and that your
LIKE term does not start with a wildcard, this will execute three indexed
queries and combine the results. If the same row is returned by more than one
query, it will appear only once in the result set. If you want it to appear
for each query it matches, use UNION ALL in place of UNION.
--
Larr
>>