M
miguel.guerreiro
Hi folks,
I wanted to create a query that returns a list of company names sorted
alphabetically, and then I just add 1 line (constant) to the top of the
list so my results should look like:
_____________
MyStringHere
Axxxx
Bxxxxx
Cxxxx
Dxxxxx
_____________
I created the following query that works and does everything I want,
except the sorting is screwed up. It ignores the ORDER BY clause and
doesn't sort anything.
SELECT DISTINCT 'MyStringHere' FROM tblAddress
UNION ALL
(SELECT Company FROM tblAddress ORDER BY Company ASC);
So, this query actually gives me a result that looks like:
____________
MyStringHere
Cxxxx
Axxxx
Dxxxxx
Bxxxx
Any idea on how I can get this UNION to be sorted the way I need it ?
Thanks.
I wanted to create a query that returns a list of company names sorted
alphabetically, and then I just add 1 line (constant) to the top of the
list so my results should look like:
_____________
MyStringHere
Axxxx
Bxxxxx
Cxxxx
Dxxxxx
_____________
I created the following query that works and does everything I want,
except the sorting is screwed up. It ignores the ORDER BY clause and
doesn't sort anything.
SELECT DISTINCT 'MyStringHere' FROM tblAddress
UNION ALL
(SELECT Company FROM tblAddress ORDER BY Company ASC);
So, this query actually gives me a result that looks like:
____________
MyStringHere
Cxxxx
Axxxx
Dxxxxx
Bxxxx
Any idea on how I can get this UNION to be sorted the way I need it ?
Thanks.