MySQL Forums
Forum List  »  Newbie

parse by delimiter and search a data field?
Posted by: Charles Tronolone
Date: April 27, 2009 07:11PM

hi all -- i need some help.

here's my table:

id | stringOfNums
-----------------
01 | '8,3,17,22'
02 | '2,9,15,43'
03 | '11,2,88,5'
03 | '4,65,41,7'

is there a way for mysql to retrieve the "id" of every row where the stringOfNums contains either "2" or "4"?

i guess my query would look something like this:

SELECT id FROM table WHERE stringOfNums CONTAINS(2,4)

i know there is another way to do this involving the creation of a brand new table, but i have a lot of data fields similar to this one and it would spawn the growth of a whole crapload of skinny new tables... i rather not go down that road.

thanks for any help,

charlie



Edited 1 time(s). Last edit at 04/27/2009 07:42PM by Charles Tronolone.

Options: ReplyQuote


Subject
Written By
Posted
parse by delimiter and search a data field?
April 27, 2009 07:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.