spiceydog Posted August 11, 2008 Share Posted August 11, 2008 I have a query that basically says "WHERE something LIKE %something% or somethingelse LIKE %something%" but I want it to sort by the field name so like all rows where something LIKE %something% is in front of somethingelse LIKE %something% results. Is there anyway of doing this WITHOUT unions? if not.. I really am confused by unions. could someone show me an example? Quote Link to comment Share on other sites More sharing options...
fenway Posted August 12, 2008 Share Posted August 12, 2008 You can order by as many fields as you'd like.... Quote Link to comment Share on other sites More sharing options...
spiceydog Posted August 13, 2008 Author Share Posted August 13, 2008 you can order alphabetically and such... what I want is all results where something = $search to be first in the search results list BEFORE the results where somethingelse = $search. i dont know how else to put it... "ORDER BY something, somethingelse" will not work for this. Quote Link to comment Share on other sites More sharing options...
bluejay002 Posted August 13, 2008 Share Posted August 13, 2008 can you be more descriptive with that something and somethingelse? say, can you give the table structure, the fields you want to get, what field to search and how to sort it. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 13, 2008 Share Posted August 13, 2008 you can order alphabetically and such... what I want is all results where something = $search to be first in the search results list BEFORE the results where somethingelse = $search. i dont know how else to put it... "ORDER BY something, somethingelse" will not work for this. If you're talking about weighting your search results, you'll have to design this. Quote Link to comment Share on other sites More sharing options...
spiceydog Posted August 14, 2008 Author Share Posted August 14, 2008 mhmm.. fixed it all.. just use UNIONs... works great.. 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.