jasonc Posted November 27, 2010 Share Posted November 27, 2010 i wish to search for members of my site that fit a criteria. say age, gender, something, somethingelse. I wish to know how I can search for all possible combinations of these searches. say the search for all 4 returns no results then it searches then the next search query need to find all other conbinations that closely match. say age, gender, something; if none then age, gender, somethingelse; if none then age, something, somethigelse. (not so much in this order but any order) or can this be done with one query? Link to comment https://forums.phpfreaks.com/topic/219977-16-possible-searches-in-one-query-is-it-possible/ Share on other sites More sharing options...
fenway Posted November 27, 2010 Share Posted November 27, 2010 Why not search everything and simply adjust the weights? Link to comment https://forums.phpfreaks.com/topic/219977-16-possible-searches-in-one-query-is-it-possible/#findComment-1140401 Share on other sites More sharing options...
s0c0 Posted November 27, 2010 Share Posted November 27, 2010 Umm... SELECT * FROM my_table WHERE (age = '18' AND gender = 'M') OR (age = '18' AND eyes = 'Blue') Does something like this not work? Link to comment https://forums.phpfreaks.com/topic/219977-16-possible-searches-in-one-query-is-it-possible/#findComment-1140404 Share on other sites More sharing options...
s0c0 Posted November 27, 2010 Share Posted November 27, 2010 Interestingly enough High Performance MySQL has a chapter on query/index optimization that has an example VERY similar to your post. Just found that kinda interesting. Link to comment https://forums.phpfreaks.com/topic/219977-16-possible-searches-in-one-query-is-it-possible/#findComment-1140406 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.