answersLogoWhite

0


Best Answer

Assuming you want to find the greater of 3 values that are in a table, you could do it this way: CREATE TABLE #T ( Column1 INT, Column2 INT, Column3 INT ) INSERT #T VALUES (-100, 25, 1000) INSERT #T VALUES (2, 66, 10) INSERT #T VALUES (110, 0, 200) INSERT #T VALUES (-1, -2, -3) INSERT #T VALUES (1, 2, 3) INSERT #T VALUES (3, 2, 1) INSERT #T VALUES (1, 3, 2) INSERT #T VALUES (2, 3, 3) SELECT CASE WHEN Column1 >= Column2 AND Column1 >= Column3 THEN Column1 WHEN Column2 >= Column3 AND Column2 >= Column1 THEN Column2 ELSE Column3 END AS MaxValue FROM #T DROP TABLE #T

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you find the greatest of three numbers in using CASE statement in sql?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you find the greatest of three numbers using ternery operator?

Compare the first two numbers with the ternary operator. Store the result in a temporary variable. Compare the temporary variable with the third number, again using the ternary operator.


What is the greatest and the smallest 4 digit numbers using the digit 1234?

smallest=1234 greatest=4321


What is the greatest possible odd number using numbers 76038?

87603


Find the greatest common factor of the numbers using prime factorization?

i dont know what that means does anyone get this"find the greatest common factor of the numbers using prime factorization We'll be eager to jump on it as soon as you give us the numbers.


Is 5291 a prime number using 2 numbers?

No 5291 is not a prime using 2 numbers. It is a prime using three numbers.


How do you reconcile your check register with a bank statement?

Using cheque numbers to find which ones have been presented (appearing on the bank statement)


How do you print strings and numbers in single statement by using C language?

With printf.Example:for (i=0; i


What is the greatest difference in a subtraction using the numbers 1 2 4 and 5 only once?

The greatest difference is 541


Can you find greatest common factor of 3 numbers using Euclid's lemma?

Yes, you can.


What is the next greatest common factor of the numbers using prime factor 24 36?

The GCF is 12. The next greatest is 6.


Write a FORTRAN program using if statement to calculate the smallest of three numbers xyz?

N = x If y < N then N = Y If z < N then N = z Print N


How many whole numbers can you make using the first three whole numbers?

Using 1, 2, and 3, you can make 27 whole numbers.