Gossamer Forum
Home : General : Databases and SQL :

Need help on creating a specific SQL statement

Quote Reply
Need help on creating a specific SQL statement
Does anybody know how to create an SQL statement to search for a word in a expression. Here is an example: The field Catagory contains this: "CAS;Arbitrage;4;LID;Holiday Cards;DM;Client;Perspectives;MRC;Key Customer;CFD;2;Announcements"

I want to create a query that displays all the users that should receive holiday cards. But my problem is that the feild catagory contains other text. How do I create a statement such as select * from table where Catagories = Holiday Card. Is there any thing I can use to scan the catagory field for the word Holiday Cards. Please let me know.

Thanks

Last edited by:

teaminfinite: Jul 8, 2002, 9:28 AM
Quote Reply
Re: [teaminfinite] Need help on creating a specific SQL statement In reply to
Not quite sure what you are asking. Maybe something like;

SELECT * FROM Table_Name WHERE Categories LIKE %Holiday Card%

Unsure

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Need help on creating a specific SQL statement In reply to
if the Catagory Field contains the text: "Announcements;Arbitrage;Client;Holiday Cards;MRC;MuniSolutions;Perspectives"

and i want to create a query to check if Catagory = "Holiday Cards" how can i do this.
Quote Reply
Re: [teaminfinite] Need help on creating a specific SQL statement In reply to
Using the LIKE operator as Andy showed (although should be ColumnName LIKE '%Holiday Card%'), you can find words "like" the string you are looking for.

BTW: That is pretty ugly in terms of normalization rules in SQL databases.
========================================
Buh Bye!

Cheers,
Me