这是我创建 出库表的代码
/*创建出库信息表*/
create table tb_OutStore
(
OSID int IDENTITY(1,1) PRIMARY KEY,/*出库编号*/
PGPeople varchar(20) not null,/*领用人*/
OSDate datetime DEFAULT (getdate()),/*出库日期*/
MaterialID int references tb_Material(MaterialID),/*材料ID*/
MaterialName varchar(20) not null,/*材料名称*/
MaterialSpec varchar(20),/*材料规格*/
MaterialUnit varchar(10) default 'T',/*材料单位*/
MaterialPrice money check (MaterialPrice>0),/*材料单价*/
MaterialNum float check (MaterialNum>0),/*材料数量*/
MaterialAPrice AS ([MaterialNum] * [MaterialPrice]),/*材料总价 自动计算*/
HandlePeople varchar(20),/*检验人*/
OSRemark varchar(200)/*备注*/
)
需要查询累计领用金额超过100万的领用人有哪些。
这条SQL语句该怎么写啊?
------解决方案--------------------
select PGPeople from tb_OutStore group by PGPeople having sum(MaterialPrice * MaterialNum) > 1000000
------解决方案--------------------
- SQL code
select PGPeoplefrom tb_OutStoregroup by PGPeoplehaving sum(MaterialAPrice)>1000000
------解决方案--------------------
当您的问题得到解答后请及时结贴.
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html
8、如何给分和结贴?
http://community.csdn.net/Help/HelpCenter.htm#结帖