take one table is t1 and in that column name is f1
f1 column values are
200
5000
3000
7000
300
600
100
400
800
400
i want display the values asc and desc in a single output.
sample output is
f1.a
100
200
300
400
500
600
etc......
and f1.d is
5000
4000
3000
2000
1000
etc...

Answer Posted / jitendra

#The ORDER BY keyword is used to sort the result-set by a #specified column.
#The ORDER BY keyword sort the records in ascending order by #default.
#If you want to sort the records in a descending order, you #can use the DESC keyword.

#1. display the values ascending order

SELECT f1 FROM t1 ORDER BY f1 AS f1.a

#2. display the values descending order

SELECT f1 FROM t1 ORDER BY f1 DESC AS f1.d

Is This Answer Correct ?    0 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between the repeatable read and serializable isolation levels? : Transact sql

533


how to show all tables with 'mysql'? : Sql dba

610


What is pivot query?

596


What is snowflake sql?

582


How do I start sql from command line?

534






how tsql statements can be written and submitted to the database engine? : Transact sql

534


What are the different datatypes available in PL/SQL?

568


How do you delete a table?

540


Is sql the best database?

503


What is crud sql?

543


what is bcp? When does it used? : Sql dba

526


What is primary key and foreign key?

534


Can pl sql procedure have a return statement?

552


What is rollback?

584


What is the purpose of the sql select top clause?

557