tqla Posted December 31, 2008 Share Posted December 31, 2008 Hello. This will select everything from the the Search table where the Keywords field is like cookies. SELECT * FROM search WHERE Keywords LIKE '%cookies%'; I also want to look in a field called Data in the same table. How do I select everything from the Search table where the Keywords field AND the Data field are like cookies? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/139015-solved-select-help/ Share on other sites More sharing options...
Maq Posted December 31, 2008 Share Posted December 31, 2008 How do I select everything from the Keywords field AND the Data field? I don't understand... You are selecting from the Keywords and Data field, this is what * does. Do you mean you want to search in the Keywords and Data fields? If so, do you want to select only what is in Keywords AND Data or, Keywords OR Data? Quote Link to comment https://forums.phpfreaks.com/topic/139015-solved-select-help/#findComment-727066 Share on other sites More sharing options...
rhodesa Posted December 31, 2008 Share Posted December 31, 2008 if you want cookies to be in BOTH: SELECT * FROM search WHERE Keywords LIKE '%cookies%' AND Data LIKE '%cookies%' if you want cookies to be in either or: SELECT * FROM search WHERE Keywords LIKE '%cookies%' OR Data LIKE '%cookies%' Quote Link to comment https://forums.phpfreaks.com/topic/139015-solved-select-help/#findComment-727068 Share on other sites More sharing options...
tqla Posted December 31, 2008 Author Share Posted December 31, 2008 Thank you rhodesa. I appreciate the help. Maq, I noticed that I made a mistake in my original post so I modified it just as you were replying. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/139015-solved-select-help/#findComment-727071 Share on other sites More sharing options...
Maq Posted December 31, 2008 Share Posted December 31, 2008 Thank you rhodesa. I appreciate the help. Maq, I noticed that I made a mistake in my original post so I modified it just as you were replying. Thanks. Ah, yes I see. Quote Link to comment https://forums.phpfreaks.com/topic/139015-solved-select-help/#findComment-727072 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.