nguyenanhque.sql.2
select * from nhacc
where diachi like '%Q1 HCM%'
order by tennhacc
--c
use qlbanhang
select *,slnhap*dgnhap as thanhtien from ctpnhap
--d
select pnhap.sopn,ngaynhap,pnhap.sodh,sum(dgnhap*slnhap) as giatri
from pnhap,ctpnhap
where pnhap.sopn=ctpnhap.sopn
group by pnhap.sopn,ngaynhap,pnhap.sodh
--f
select sopx,sum(slxuat*dgxuat) as Tongtrigia
from ctpxuat
group by sopx
order by tongtrigia desc
--g
delete from ctdondh
from dondh
where convert(char(30),ngaydh,103)='2005-01-15' and dondh.sodh=ctdondh.sodh
--h
delete from ctpxuat
--i
insert into ctpxuat values('X001','DD01','2',convert(money,'3500000'))
insert into ctpxuat values('X002','DD01','1',convert(money,'3500000'))
insert into ctpxuat values('X002','DD02','5',convert(money,'4900000'))
insert into ctpxuat values('X003','DD01','3',convert(money,'3500000'))
insert into ctpxuat values('X003','DD02','2',convert(money,'4900000'))
insert into ctpxuat values('X003','VD02','10',convert(money,'3250000'))
--j
select *,(slxuat*dgxuat) as thanhtien
from ctpxuat
order by sopx
compute sum(slxuat*dgxuat) by sopx
select *,slnhap*dgnhap as ThanhTien
from ctpnhap
order by mavtu
compute sum(slnhap),min(slnhap*dgnhap),max(slnhap*dgnhap) by mavtu
Bạn đang đọc truyện trên: Truyen247.Pro