Hey all,
I'm trying to write an SQL query that would populate a dropdown box of locations. In addition, I need the query to select the location associated with a user automatically (ie: be the first in the list results.) I had the following, but recently realized that the list isn't completely alphabetized. To add another level to this, presume that I only have SELECT access to this database.
select
[LOCATION]
from User_Table
where [ALIAS] = 'UserName'
UNION all
select
distinct [LOCATION]
from Location_Table
where [STATUS_VALUE] ='Open'
If I "order by 1", then the location associated with the user is shuffled in with others and not the first item on the list.
Any help would be awesome.
EDIT: Maybe this will help to make it clearer. The larger list of locations seem to be built quasi-alphabetically based on their indexes. So halfway through the list, I get results like this:
WOODBRIDGE YOKOTA/JAPAN ABERDEEN PROVING GROUND ALBUQUERQUE