thedarkwinter Posted August 29, 2007 Share Posted August 29, 2007 hi im trying to select * from a table where a variable represents 1 tag, and the item in the database has a list of tags: For instance, my variable is 3. There are some records where tag (varchar) is "2,3,4" or maybe just "1,5" etc. SELECT * FROM table WHERE (3 in (tags) ); returns 0 results. Any ideas? Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/67201-solved-mysql-select-x-in-xyz/ Share on other sites More sharing options...
fenway Posted August 29, 2007 Share Posted August 29, 2007 How? Link to comment https://forums.phpfreaks.com/topic/67201-solved-mysql-select-x-in-xyz/#findComment-337256 Share on other sites More sharing options...
Illusion Posted August 30, 2007 Share Posted August 30, 2007 try this SELECT * FROM table WHERE if(FIND_IN_SET('3',tags ),TRUE,FALSE); Link to comment https://forums.phpfreaks.com/topic/67201-solved-mysql-select-x-in-xyz/#findComment-337648 Share on other sites More sharing options...
teng84 Posted September 1, 2007 Share Posted September 1, 2007 SELECT * FROM table WHERE field in ('x','y','z'); Link to comment https://forums.phpfreaks.com/topic/67201-solved-mysql-select-x-in-xyz/#findComment-339061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.