ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xianwinwin <xianwin...@gmail.com>
Subject howto do iteration with UNION
Date Wed, 03 Dec 2008 20:04:39 GMT

Hi there,

problem: I wish to get the production of a client through different period
of times.

the simple most sql will be:

*********** SQL ******************
SELECT client_ID, SUM(production) , #date1# AS start_date, #date2# AS
end_date
FROM client_production
WHERE client_ID=33293
AND production_date between #date1# and #date2#
GROUP BY client_ID

But! the date changes from period to period (eg., quarter basis through the
past 3 years).
For this, I assume I should use a UNION and change the date1/2 (if you have
better SQL solution please let me know)

* can anyone advise how to do that with <iterator>?

Thank you!
-- 
View this message in context: http://www.nabble.com/howto-do-iteration-with-UNION-tp20820524p20820524.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message