civilwarjunky
IS-IT--Management
I have writen my querry and it runs fine. I am new to sql and have not have much experiance in grouping.
Iwould like my querry have the persons name show only once, and when mulitipal programs show up I would like that to show up once with a total number of that program. Same is true with the item nume. It with past a peace of my resualts so you can see.
Select Location.name as 'Location', Contact.firstname+','+lastname as 'Name',contact.suffix,
contact.isactive,Program.name,programitem.name,quantity
from location,contact,orderitem,Program,Programitem,ddlistitem,ddlist
Where Contact.id=orderitem.contactid
and contact.primarycontacttypeid=ddlistitem.id
and Location.id= orderitem.locationid
and Program.id=programitem.programid
and Programitem.id=Orderitem.programitemid
and contact.isactive=1
and contact.suffix ='MD'
and contact.primarycontacttypeid=5
and orderitem.createdon between '2004-07-01' and '2005-01-14'
rder by Contact.lastname,orderitem.createdon
NAME PROGRAM ITEM QTY
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Iwould like my querry have the persons name show only once, and when mulitipal programs show up I would like that to show up once with a total number of that program. Same is true with the item nume. It with past a peace of my resualts so you can see.
Select Location.name as 'Location', Contact.firstname+','+lastname as 'Name',contact.suffix,
contact.isactive,Program.name,programitem.name,quantity
from location,contact,orderitem,Program,Programitem,ddlistitem,ddlist
Where Contact.id=orderitem.contactid
and contact.primarycontacttypeid=ddlistitem.id
and Location.id= orderitem.locationid
and Program.id=programitem.programid
and Programitem.id=Orderitem.programitemid
and contact.isactive=1
and contact.suffix ='MD'
and contact.primarycontacttypeid=5
and orderitem.createdon between '2004-07-01' and '2005-01-14'
rder by Contact.lastname,orderitem.createdon
NAME PROGRAM ITEM QTY
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50
Alex,Abbassi MD Pregnancy Pregnancy Spanish 50