Re: Working with FIND_IN_SET
On Sun, 8 Apr 2001, John Hart wrote: I am working on a rather large database project, in which I am making a text column that contains different data, seperated by commas. What I need to do is run a query where I will return only the datasets that contain any of sets that partially, or fully match any data in the set... For example, if the dataset contains: dark, black, small I want to be able to return this data if the query contains ran contains any of the following matches: dark black small sma bla ...etc... I do not, however, want a full LIKE search with wildcards, because I do not want to return the set if they were to search on 'all' (which would match smALL). Is there an easy way to do this, or am I forced into matching entire words in a set? I appreciate any help anyone could offer me... Thank you... John If I got you correctly, you might consider RLIKE where you define the mathing string as a regular expressions. So in you case the regexp would be something like: RLIKE ".*, YOUR_QUERY_STRING_HERE.*, .*" regards, thalis - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Working with FIND_IN_SET
You can do the same thing with like: where concat(",",myField,",") like "%,$searchString,%" this will of cause be somewhat slow, how about normalizing your database: header(id,fields) type(id,dataset) header(1,) type(1,black) type(1,dark) ... now you can select * from header,type where (id=id) and dataset in("...","...") group by id So long Martin -Original Message- From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]] Sent: Sunday, April 08, 2001 11:42 AM To: John Hart Cc: [EMAIL PROTECTED] Subject: Re: Working with FIND_IN_SET On Sun, 8 Apr 2001, John Hart wrote: I am working on a rather large database project, in which I am making a text column that contains different data, seperated by commas. What I need to do is run a query where I will return only the datasets that contain any of sets that partially, or fully match any data in the set... For example, if the dataset contains: dark, black, small I want to be able to return this data if the query contains ran contains any of the following matches: dark black small sma bla ...etc... I do not, however, want a full LIKE search with wildcards, because I do not want to return the set if they were to search on 'all' (which would match smALL). Is there an easy way to do this, or am I forced into matching entire words in a set? I appreciate any help anyone could offer me... Thank you... John If I got you correctly, you might consider RLIKE where you define the mathing string as a regular expressions. So in you case the regexp would be something like: RLIKE ".*, YOUR_QUERY_STRING_HERE.*, .*" regards, thalis - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Working with FIND_IN_SET
I am working on a rather large database project, in which I am making a text column that contains different data, seperated by commas. What I need to do is run a query where I will return only the datasets that contain any of sets that partially, or fully match any data in the set... For example, if the dataset contains: dark, black, small I want to be able to return this data if the query contains ran contains any of the following matches: dark black small sma bla ...etc... I do not, however, want a full LIKE search with wildcards, because I do not want to return the set if they were to search on 'all' (which would match smALL). Is there an easy way to do this, or am I forced into matching entire words in a set? I appreciate any help anyone could offer me... Thank you... John