Clinton Posted January 4, 2009 Share Posted January 4, 2009 Let's say I've got three fields that keep track of a persons skills. These are Bobs skills... Field 1 is his primary skill, say a Carpenter. Field 2 is his secondary skill, say a Hair Dresser. Field 3 is his tertiary skill, say a Window Washer. These are Joes skills... Field 1 is his primary skill, say a Hair Dresser. Field 2 is his secondary skill, say a Carpenter. Field 3 is his tertiary skill, say a Window Washer. Now lets say I wanted to pull up all the people who are qualified to be a carpenter. How do I do this? Right now I've got: SELECT * FROM thelist WHERE pskill = 'carpentry' But this only lists the ones who have the primary skill of carpentry. If I do: SELECT * FROM thelist WHERE pskill = 'carpentry' AND sskill = 'carpentry' then it leaves out anybody who just has the primary skill (or secondary if I include the third). How do I make it so it finds all carpenters in any of those three fields without excluding everyone if one doesn't have it? Link to comment https://forums.phpfreaks.com/topic/139453-solved-where/ Share on other sites More sharing options...
saradrungta Posted January 4, 2009 Share Posted January 4, 2009 SELECT * FROM thelist WHERE pskill = 'carpentry' OR sskill = 'carpentry' Link to comment https://forums.phpfreaks.com/topic/139453-solved-where/#findComment-729471 Share on other sites More sharing options...
DarkWater Posted January 4, 2009 Share Posted January 4, 2009 SELECT * FROM thelist WHERE pskill = 'carpentry' OR sskill = 'carpentry'; Link to comment https://forums.phpfreaks.com/topic/139453-solved-where/#findComment-729473 Share on other sites More sharing options...
Clinton Posted January 4, 2009 Author Share Posted January 4, 2009 I was messing with that but it's not working... let me play with it a little bit more. Link to comment https://forums.phpfreaks.com/topic/139453-solved-where/#findComment-729474 Share on other sites More sharing options...
Clinton Posted January 4, 2009 Author Share Posted January 4, 2009 Got it. Just had by variable names wrong. :-p Thank you. Link to comment https://forums.phpfreaks.com/topic/139453-solved-where/#findComment-729482 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.