Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 30757 invoked from network); 3 Dec 2008 20:05:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Dec 2008 20:05:13 -0000 Received: (qmail 39645 invoked by uid 500); 3 Dec 2008 20:05:23 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 39349 invoked by uid 500); 3 Dec 2008 20:05:22 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 39338 invoked by uid 99); 3 Dec 2008 20:05:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 12:05:22 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 20:03:53 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1L7xxf-0004tr-Vf for user-java@ibatis.apache.org; Wed, 03 Dec 2008 12:04:39 -0800 Message-ID: <20820524.post@talk.nabble.com> Date: Wed, 3 Dec 2008 12:04:39 -0800 (PST) From: xianwinwin To: user-java@ibatis.apache.org Subject: howto do iteration with UNION MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: xianwinwin@gmail.com X-Virus-Checked: Checked by ClamAV on apache.org 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 ? 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.