The interception of the date for the six bit SQL how to write

Dear God brother, brother devoted to ask a question, as follows:
select cdate,sum(qty) qty,sum(amt) amt from MZSY_SJZX.T_DC_TST07_SYSINPC where cdate>='20131001' and cdate<='20131031' group by cdate;This query is the date for this day 20131001 the number and amount, but I want is date interception for six month for 201310 months, only show the number and amount, in accordance with the date of group by, the SQL how to write? Thank you for your advice. Thanks a million!!

Started by Hyman at December 24, 2013 - 2:17 PM

where cdate>='20131001' and cdate<='20131031'

Change month(cdate) = 10 and year(cdate) = 2013

Here 10, 2013 can be parameterized, remember the splicing of SQL variables are of type varchar. .

set cmonth = char(month(cdate));

Posted by Justin at December 27, 2013 - 3:14 PM

Learning.

Posted by Leo at December 28, 2013 - 3:29 PM