Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot

Links

XODOX
Impressum

#1: Fw: mysql query, min, max with where conditions

Posted on 2008-06-10 17:30:32 by 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" <adrian@softarea.ro>
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--

Report this message