[Q]I always understood that it is best to do everything in the sql.[/Q] Not
necessarily. Also, nothing is ever "returned" from the WHERE clause of a query,
only the SELECT. If you have a small set of posible values that will be
matching in your query, you may be able to use a CASE statement in your SELECT,
but that can get real nasty, especially as you add values to your Referer
table, since that would require you to modify your query, which is NOT a
Something like this, perhaps.
WHEN referer LIKE '%google.it%' THEN 'Google Italy'
WHEN referer LIKE '%google'% THEN 'Google'
WHEN referer LIKE '%msn%' OR referer LIKE '%live.com%' THEN 'MSN Live'
WHEN referer LIKE '%yahoo%' THEN 'Yahoo'
ELSE 'Other search engine'
END AS new_referer