Fw: mysql query, min, max with where conditions

Fw: mysql query, min, max with where conditions

am 10.06.2008 17:30:32 von William Newton

--0-464309885-1213111832=:79467
Content-Type: text/plain; charset=us-ascii




Well, if your particular problem has a well defined maximum minimum and minimum maximum (Ie the max(q) < 4294967296, because q is a 32 bit unsigned int, and min(q)> -1) then you can do it without any extra joins or sub selects.

select
a,
b,
min(IF(date <100, q, 4294967296)) as min_q,
max(IF(date>100, q, -1)) as min_q,
from a left join b left join c
group by a.p



----- Original Message ----
From: "CRISTEA, Adrian"
To: mysql@lists.mysql.com
Sent: Monday, June 9, 2008 9:33:37 AM
Subject: mysql query, min, max with where conditions

Hello there,

What is the corect syntax for selecting something like:

select
a,
b,
(min(q) where date<100),
(max(q) where date>100)
from a left join b left join c
group by a.p

i need min() max() values each of them with other WHERE clause.

How can I do that?

Adrian.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=wclarknewton@yahoo.com



--0-464309885-1213111832=:79467--