tags:

views:

556

answers:

4

hi folks,

i'm searching for a way to get from two coloumns (lets say: posx and posy) the global (whole table) maximum and minimum with just one query.

Database is MySQL

thanks

+1  A: 
 select max(posx), min(posy) from table
Tom Ritter
+2  A: 
SELECT
    MIN(colx) AS minimum,
    MAX(colx) AS maximum,
    MIN(coly) AS minimum,
    MAX(coly) AS maximum

FROM table

alexn
+7  A: 

Simple:

SELECT MIN(posx), MIN(posy), MAX(posx), MAX(posy) FROM table
Ferdinand Beyer
+2  A: 

It's really no more complex than it sounds.

SELECT MIN(posx), MAX(posx), MIN(posy), MAX(posy)
FROM yourtable
chaos