civilwarjunky
IS-IT--Management
I am somewhat new to SQL and I am have a little trouble grouging items. My querry gives me the correct resualts other than I am not so fluent with grougping. Below is my code, and I need to group by item # ,and then total quantity of each item. Can you help ? Thanks
select customer.custid as 'Custid',customer.salut as 'Contact Type',custclass.classid as 'Calsss ID',custclass.descr as 'Class',
artran.refnbr as 'Invoice #',salesperson.Name as 'Marketing Code', Trandate as 'Order Date',customer.Attn,customer.name as 'Location',
customer.addr1 as 'Physical Address',customer.addr2 as 'Physical Address 2',customer.city as 'City',
customer.state as 'State',customer.zip as 'Zip',customer.Phone as 'Phone#',customer.fax as 'Fax', customer.emailaddr as 'E-mail',
customer.billaddr1 as 'Billing Addr',customer.billaddr2 as 'Billing Addr 2',customer.billcity as 'Bill City',
billstate as 'Bill state',customer.billzip as 'Bill Zip',artran.invtid as 'item #',inventory.descr as 'discription',artran.qty as 'Qty'
from artran,Inventory,Customer,Salesperson,custclass
where artran.invtid=Inventory.invtid
and artran.custid=customer.custid
and custclass.classid=customer.classid
and customer.billstate='ca'
and not customer.custid in ('calmkt','oosmkt,CALREP')-- These codes are for in house use
and trandate between '2004-07-01' and '2005-01-12'
and Salesperson.slsperid=*artran.slsperid
select customer.custid as 'Custid',customer.salut as 'Contact Type',custclass.classid as 'Calsss ID',custclass.descr as 'Class',
artran.refnbr as 'Invoice #',salesperson.Name as 'Marketing Code', Trandate as 'Order Date',customer.Attn,customer.name as 'Location',
customer.addr1 as 'Physical Address',customer.addr2 as 'Physical Address 2',customer.city as 'City',
customer.state as 'State',customer.zip as 'Zip',customer.Phone as 'Phone#',customer.fax as 'Fax', customer.emailaddr as 'E-mail',
customer.billaddr1 as 'Billing Addr',customer.billaddr2 as 'Billing Addr 2',customer.billcity as 'Bill City',
billstate as 'Bill state',customer.billzip as 'Bill Zip',artran.invtid as 'item #',inventory.descr as 'discription',artran.qty as 'Qty'
from artran,Inventory,Customer,Salesperson,custclass
where artran.invtid=Inventory.invtid
and artran.custid=customer.custid
and custclass.classid=customer.classid
and customer.billstate='ca'
and not customer.custid in ('calmkt','oosmkt,CALREP')-- These codes are for in house use
and trandate between '2004-07-01' and '2005-01-12'
and Salesperson.slsperid=*artran.slsperid