select a.编号,sum(a.数量),sum(a.金额)
from table1 a,table2 b
where a.编号 = b.编号
and b.日期 >= '2003-10-01'
and b.日期 <= '2003-10-31'
group by a.编号
from table1 a,table2 b
where a.编号 = b.编号
and b.日期 >= '2003-10-01'
and b.日期 <= '2003-10-31'
group by a.编号
调试欢乐多
select 编号,sum(数量),sum(金额)
from table1
where a.编号 in (select 编号 from table2 where 日期 >= '2003-10-01'
and 日期 <= '2003-10-31' )
group by a.编号
“要求Table1的所有【编号】相同的列,其【数量】和【金额】分别累计相加成为一列,"
应该是
”要求Table1所有【编号】在Table2的【日期】相同的【编号】中,其【数量】和【金额】分别累计相加成为一列,“
不好意思,请
ropriest(馆主) 再帮忙想想办法
from table1 a,table2 b
where a.编号 = b.编号
and b.日期 >= '2003-10-01'
and b.日期 <= '2003-10-31'
group by b.日期
不知道这个是不是你所要的,呵呵
join table2 B on A.编号=B.编号
Where B.日期 >='2003-10-01' and B.日期 <='2003-10-31'
group by B.日期 不知道这个行不!!