opposite of WHERE IN
Moderator: General Moderators
opposite of WHERE IN
Is there an opposite to where in function? Basically I have a text column with country codes such as 'GB, US, AU' and I want to select only the rows that have 'GB'
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
I must be misunderstanding you since the solution is far too obviousI want to select only the rows that have 'GB'
Code: Select all
WHERE country = 'GB'Ha, no the column holds comma delimited values. So you get one value 'GB' from the user, then have to find matching rows from a column that has the comma delimited values..
However I did just find a solution that works..
However I did just find a solution that works..
Code: Select all
SELECT id
FROM `geo_settings`
WHERE find_in_set( 'GB', `country_codes` ) != ''
-
jamiel
- Forum Contributor
- Posts: 276
- Joined: Wed Feb 22, 2006 5:17 am
- Location: London, United Kingdom
Code: Select all
LIKE '%GB%'