Posted on 2009-12-28 11:23
blues 阅读(316)
评论(0) 编辑 收藏 所属分类:
Data Base
mysql:
select m.name, date_format(p.promiseddate,'%Y-%m-%d'), sum(p.countes), sum(p.amount)
from pu_po_list p left join m_materiel m
on p.materiel_id=m.id
where p.org_id=(select u.org_id from s_user u where u.value='ycz')
and m.name in ('产品0','产品2')
group by m.name, p.promiseddate with rollup;
Orcale:
select m.name, sum(p.countes), sum(p.amount) from pu_po_list p left join m_materiel m
on p.materiel_id=m.id
where
p.org_id=(select u.org_id from s_user u where u.value='ycz')
--and m.name like '%000%'
--and p.promiseddate > to_date('2007-08-31','yyyy-MM-dd')
--and p.promiseddate < to_date('2007-10-1','yyyy-MM-dd')
group by rollup (m.name);