English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am having a brain-fart here.

How can I select the single highest number in a column?

ex: a table column has values 4,3,6,1,7,1,4 in it, I want to return ONLY the single highest value '7', how do I do that?

SELECT ???
FROM table
WHERE x = 'bla'

thanks ahead of time!

2006-12-13 07:54:09 · 3 answers · asked by stan_naspinski 3 in Computers & Internet Programming & Design

3 answers

Depends on which version of SQL you are using. Microsoft SQL and MySQL handle this query differently.

Select TOP is one option.
Select MAX is another.

2006-12-13 07:56:13 · answer #1 · answered by Snoopy 5 · 0 1

25

2006-12-13 15:56:13 · answer #2 · answered by lola 3 · 0 3

SELECT MAX(fieldname)
FROM table
WHERE conditional.

2006-12-13 16:06:23 · answer #3 · answered by Jason C 2 · 1 0

fedest.com, questions and answers