Sorry, query was wrong... has to be:
SELECT *, CONCAT(',',someFieldInMyTable,',') as wherefield FROM MyTable
WHERE wherefield LIKE '%,1,%'
Mike van Hoof schreef:
Hey Charlie,
maybe there is, but i don't know why... because when you do a like
query it also finds the 21 when you do a like on the 1.
what you maybe can do (not tested) is:
SELECT *, CONCAT(',',someFieldInMyTable,',') as wherefield FROM
MyTable WHERE wherefield='%,1,%'
Now your someFieldInMyTable is CONCATed to ,1,2,3,4,5,6,9,21, and over
that value the where clause is done...
Maybe it helps
Mike
Charlie Schaubmair schreef:
Hello Mike,
thx, but isn't there another way?
br
Charlie
-----Ursprüngliche Nachricht-----
Von: Mike van Hoof [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 16.
August 2006 10:46
An: Charlie Schaubmair
Cc: mysql@lists.mysql.com
Betreff: Re: find in list
Charlie Schaubmair schreef:
Hello,
I want to do a query where I only gt the results by an
numeric value:
select * from MyTable where 1 IN someFieldInMyTable I know
this query
doesn't work, but maybe anyone knows what I mean.
1 can be a value betwenn 1 and 23
someFieldInMyTable is normaly a list like: 1,2,3,4,5,6,9,21
br
Charlie
Hey
try:
SELECT * FROM MyTable WHERE someFieldInMyTable='%1%'
This will also give you results like 21
What I usally do in these cases is build the values like this:
[1][2][3][21]
And then te query:
SELECT * FROM MyTable WHERE someFieldInMyTable='%[1]%'
Mike
--
Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024
fax: 040-29 63 567
url: www.medusa.nl
mail: [EMAIL PROTECTED]
Uw bedrijf voor Multimedia op Maat
--
Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024
fax: 040-29 63 567
url: www.medusa.nl
mail: [EMAIL PROTECTED]
Uw bedrijf voor Multimedia op Maat
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]