Click here to Skip to main content
15,881,833 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my ASP.Net project, I have several queries to load data from the Oracle DB. One of the query string is below:
HTML
SELECT distinct VCRS FROM TBL_VPOSITION ACS

How the data obtained is in descent order rather than in ascent order.
If I run the query string in Oracle SQL Developer, the obtained results are normal.
Do you know why it happens? Thanks.
Posted

1 solution

Your query hasn't specified any sort order. Instead, you've specified an alias of "ACS" for the table "TBL_VPOSITION".

Add an ORDER BY clause[^] to your query:
SQL
SELECT DISTINCT VCRS FROM TBL_VPOSITION ORDER BY VCRS ASC
 
Share this answer
 
Comments
s yu 7-Aug-15 13:15pm    
Got error using your query string: SQL Error: ORA-00933: SQL command not properly ended. I through yours should be right.
Richard Deeming 7-Aug-15 13:20pm    
How are you calling the query? Is it part of a view, a nested query, or a UNION query?
s yu 7-Aug-15 13:26pm    
I run the query in Oracle SQL developer. No union at all.
Richard Deeming 7-Aug-15 13:28pm    
You could try adding a semi-colon to the end, but if your original query was working, I don't think it will make a difference.
SELECT DISTINCT VCRS FROM TBL_VPOSITION ORDER BY VCRS ASC;
s yu 7-Aug-15 13:43pm    
Already tried w/ the same result. Stranger, your answer should be right.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900