aebstract Posted March 19, 2008 Share Posted March 19, 2008 I suck at regular expressions.. I know some of the commands and whatnot, and almost understand the syntax of it. I'm wanting to retrieve information from a database, basically a simple search engine. It will search one column for anything that includes what was searched for. Example being: If you search for 20. Let's say there are 3 parts with 20 in them, BPRSW20 SWO20JAL 204589 I want to be able to retrieve the rows with these parts in them. Any row that has the searched for criteria, anywhere in the part number. I don't want anyone to write this for me but help me out with how I would go about doing it please. Quote Link to comment Share on other sites More sharing options...
effigy Posted March 19, 2008 Share Posted March 19, 2008 If your searches remain simple, you can use wildcards: SELECT * FROM table WHERE field LIKE '%20%' Quote Link to comment Share on other sites More sharing options...
aebstract Posted March 19, 2008 Author Share Posted March 19, 2008 What do the % signs do? If my search was for say "RKK-940" would it be like %RKK-940% and find that exact matching in my part numbers? So it would find part SPRKK-940006 ? Quote Link to comment Share on other sites More sharing options...
effigy Posted March 19, 2008 Share Posted March 19, 2008 Per the docs: With LIKE you can use the following two wildcard characters in the pattern: % -- Matches any number of characters, even zero characters _ -- Matches exactly one character So it would find part SPRKK-940006 ? Correct. Quote Link to comment Share on other sites More sharing options...
aebstract Posted March 19, 2008 Author Share Posted March 19, 2008 Works just like what I was looking for, thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.