Just write
Select id,name,age
From Student
Where age < 15
Union
Select id,name,age
From Student
Where Name like "%a%"
Order by name
the order by is applied to the complete resultset
More Related Contents:
- SQL Query – Using Order By in UNION
- SQL Server UNION – What is the default ORDER BY Behaviour
- Sort by column ASC, but NULL values first?
- MySQL: Alternatives to ORDER BY RAND()
- PostgreSQL DISTINCT ON with different ORDER BY
- How to get matching data from another SQL table for two different columns: Inner Join and/or Union?
- SQL best practice to deal with default sort order
- What is the difference between JOIN and UNION?
- Using union and order by clause in mysql
- Optimize query with OFFSET on large table
- When no ‘Order by’ is specified, what order does a query choose for your record set?
- How to use DISTINCT and ORDER BY in same SELECT statement?
- SQL how to make null values come last when sorting ascending
- How to use Oracle ORDER BY and ROWNUM correctly?
- How do I return rows with a specific value first?
- SQL (ORACLE): ORDER BY and LIMIT [duplicate]
- How to use SQL Order By statement to sort results case insensitive?
- How to ORDER BY a SUM() in MySQL?
- SQLite and custom order by
- PostgreSQL ORDER BY issue – natural sort
- Why do NULL values come first when ordering DESC in a PostgreSQL query?
- Combine two tables for one output
- Alphanumeric sorting with PostgreSQL
- Sorting string column containing numbers in SQL?
- SQL ORDER BY date problem
- “Order By” using a parameter for the column name
- SQL for ordering by number – 1,2,3,4 etc instead of 1,10,11,12
- How to get results in a custom order? [closed]
- SQL ORDER chars numerically
- Dynamic order direction