Sql

Asked • 03/18/19

How to order by with union?

Is it possible to order when the data is come from many select and union it together.Such as Select id,name,age From Student Where age < 15 Union Select id,name,age From Student Where Name like "%a%" How can I order this query by name. Some said you can query look like this. Select id,name,age From Student Where age < 15 or name like "%a%" Order by name But in this case I just ignore that solution. Thank you in advance.

2 Answers By Expert Tutors

By:

Ahmad M. answered • 01/17/24

Tutor
New to Wyzant

Oracle Database & Infrastructure administrator 6+ years experience

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.