phporcaffeine Posted January 24, 2007 Share Posted January 24, 2007 Example:column 'test' = '|48962||34545|'I need to be able to SELECT based on column 'test' but I may only have |48962| and not |34545|.I tried:SELECT col1, col2, col3 FROM tbl WHERE test LIKE |48962|but it didn't work, any ideas?-Thanks Link to comment https://forums.phpfreaks.com/topic/35527-trying-to-use-like-but-i-might-be-wrong/ Share on other sites More sharing options...
mjlogan Posted January 24, 2007 Share Posted January 24, 2007 SELECT col1, col2, col3 FROM tbl WHERE test = 48962 AND test != 34545 ??? Link to comment https://forums.phpfreaks.com/topic/35527-trying-to-use-like-but-i-might-be-wrong/#findComment-168222 Share on other sites More sharing options...
fenway Posted January 24, 2007 Share Posted January 24, 2007 [quote author=mjlogan link=topic=123841.msg512440#msg512440 date=1169657721]SELECT col1, col2, col3 FROM tbl WHERE test = 48962 AND test != 34545[/quote]That's incorrect -- what you need is: [code]SELECT col1, col2, col3 FROM tbl WHERE test LIKE '%|48962|%'[/code]Of course, what you really need is a normalized DB, and not store delimited lists in a single fiedl Link to comment https://forums.phpfreaks.com/topic/35527-trying-to-use-like-but-i-might-be-wrong/#findComment-168488 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.