You are here: Re: can anyone solve this sql query? « MsSQL Server « IT news, forums, messages
Re: can anyone solve this sql query?

Posted by Helmut Woess on 10/16/06 11:03

Am 16 Oct 2006 00:47:31 -0700 schrieb hardik:

....
> id fid
> ___________________________________
> 1 1,2,3,4,5
>
> 2 11,12,13,14,15
>
> now to find values i am using query
>
> sql = SELECT * FROM test12 WHERE `fid` LIKE ('%1%')
>
> only problem in this query is it is selecting 1 and 11 and i require
> only 1 as i am giving one in %1%
> now any one have answer of this question then plz plz tell me ........

If ',' is your separator you can use:
SELECT * FROM test12 WHERE `fid` = '1' or `fid` LIKE ('1,%') or
`fid` LIKE ('%,1,%') or `fid` LIKE ('%,1')

bye, Helmut

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация