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 Quote Link to comment 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 ??? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.