On Thursday 29 November 2001 23:50, Graham Nichols wrote:
> Hi,
>
> I have a table which contains a column 'category'
>
>
> 'category' can be made up as records such as:
>
> christmas|birthday|easter
> easter|thanksgiving
> birthday|christmas|thanksgiving|easter
>
> etc .....
>
> As you can see, items are delimited with a '|' in the fields. If I wish to
> select all records which contain 'christmas', what is the correct sql
> syntax please?
> (This should return records 1 and 3 from the example shown above)
SELECT * FROM table WHERE category LIKE '%christmas%'
should do the trick.
hth
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Horngren's Observation:
Among economists, the real world is often a special case.
*/
---------------------------------------------------------------------
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