troubleshooting Question

2 selects combined into 1 result set

Avatar of razza_b
razza_b asked on
Microsoft SQL ServerMicrosoft SQL Server 2008
4 Comments2 Solutions326 ViewsLast Modified:
Hi

needing help with a query, just now i have 2 selects statements doing this...

                  SELECT sum(TaQty) as 'Pass Qty'
        FROM TBLTRANSACTION WITH (NOLOCK) where tajobkey = @job
        and TaTransCdKey = 'OutAccept'
        and TaStationIdKey = @station
        group by TaQty
        
        SELECT sum(TaQty) as 'Fail Qty'
        FROM TBLTRANSACTION WITH (NOLOCK) where tajobkey = @job
        and TaTransCdKey = 'OutReject'
        and TaStationIdKey = @station
        group by TaQty

and the output is 2 seperate results e.g.
Pass Qty
1280

Fail Qty
1

but im needing to combine the 2 so that they are returned in same result set (1 row) as
Pass Qty  Fail Qty
1280       1


Thanks
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros