select a.客户编号,c.类别,count(c.货品编号) 货量 from orders a ,items b,goods c where a.销售日期 between :datefrom and :dateto and a.单号=b.单号 and b.货品编号=c.货品编号 group by a.客户编号, c.类别我没试过,大概这样吧。try! :)
用Query绝对没有问题. 也不复杂.看看SQL的书吧.
在Query的SQL语句中用group by 汇总可得汇总数据 如还要总汇总,就用 union 来连接总汇总的查询语句
from orders a ,items b,goods c
where a.销售日期 between :datefrom and :dateto
and a.单号=b.单号 and b.货品编号=c.货品编号
group by a.客户编号, c.类别我没试过,大概这样吧。try! :)
如还要总汇总,就用 union 来连接总汇总的查询语句
能说一下临时表如何用吗?那里有范例?