Jump to content

How can you sort union results as a single table?


wright67uk

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.