Home > database >  SQL based
SQL based

Time:11-21

SQL input number 3, according to the order from large to small output (using the IF statement)

CodePudding user response:

 
Declare @ a int, int, @ b @ c int
The set @ a=12
The set @=7 b
Set @ 9 c=


Select the id from
(
Union all select @ a as id
Union all select @ b
Select @ c
) a
The order by id desc

/*
Id
-- -- -- -- -- -- -- -- -- -- --
12
9
7

(3 rows affected)

*/

CodePudding user response:

Thank you, love!!

CodePudding user response:

Use nor IF statements like it
  • Related