sql server 2008 - Is It Possible To Combine These Two Queries -
sql server 2008 - Is It Possible To Combine These Two Queries -
i need results of query 2 input in slot [data query 2 should go here]
displayed in query 1. have been running both queries individually , manually inputting #'s possible run of 1 query?
--query 1 select case when employee 'ricardo%' '38526' when employee 'james%' '44187' else employee end [employee], count(case when d.shipped_status in ('hold', 'waiting approval') d.id else null end) [processing], count(case when d.shipped_status = 'shipped' d.id else null end) [shipped], count(case when d.shipped_status = 'pending' d.id else null end) [pending], --this secondary query should go '' [data query 2 should go here] employeesales d.employee not null grouping case when employee 'ricardo%' '38526' when employee 'james%' '44187' else employee end --query 2 select case when employee 'ricardo%' '38526' when employee 'james%' '44187' else employee end [employee], count(case when b.itemcode = '1400' d.id else null end) + count(case when a.shipped_status = 'out of stock' a.id else null end) inventory inner bring together itemsordered b on a.id = b.id grouping case when employee 'ricardo%' '38526' when employee 'james%' '44187' else employee end [employee]
sql-server-2008
Comments
Post a Comment