wright67uk Posted May 13, 2013 Share Posted May 13, 2013 SELECT name FROM `races` WHERE `name` LIKE '$search%' GROUP BY NAME UNION SELECT horse_name FROM `notes` WHERE `horse_name` LIKE '$search%' GROUP BY horse_name"; Returns a single list of names that are sorted alphabetically per table ab - results of races ac - results of races ad - results of races ab - results of notes ac - results of notes ad - results of notes how can I change my query so that all of my results are sorted alphabetically as a whole? eg ab - results of races ab - results of notes ac - results of races ac - results of notes Link to comment https://forums.phpfreaks.com/topic/277952-how-can-you-sort-union-results-as-a-single-table/ Share on other sites More sharing options...
Barand Posted May 13, 2013 Share Posted May 13, 2013 SELECT ... UNION SELECT ... ORDER BY name Link to comment https://forums.phpfreaks.com/topic/277952-how-can-you-sort-union-results-as-a-single-table/#findComment-1429829 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.