I have three select queries which return total records , succesful records and failure records from same table based on different where clauses . I want to join the result of all these statements into one table in order to make my stored procedure but the resulting table shall have three different columns for cdr , success , failure
SELECT Count(*) AS cdr
FROM ABC AS c WITH (NOLOCK)
WHERE APPID IN( 1, 2 )
AND CALLDATE = '2012-10-09'
SELECT Count(*) AS success
FROM ABC AS d WITH (NOLOCK)
WHERE APPID IN( 44, 45 )
AND CALLDATE = '2012-10-09'
AND HANGUPCODE IN ( 'man', 'mach' )
SELECT Count(*) AS fail
FROM ABC WITH (NOLOCK)
WHERE APPID IN( 44, 45 )
AND CALLDATE = '2012-10-09'
AND HANGUPCODE NOT IN ( 'man', 'mach' )
Union gives out the result in one column so it won't work . any other ideas