Getting Result from Null Query. I would like to have the document name from the query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nabeelanwer
    New Member
    • Jun 2015
    • 1

    Getting Result from Null Query. I would like to have the document name from the query

    Code:
    select b, count(b), a from (
    SELECT 'ABC Doc' as b, Region as a from table1
    union all
    SELECT 'DEF Doc' as b, Region as a from table2
    ) group by region, doc
    
     DOC                   	2   	REGION
     --------------------- 	--- 	--------------
     ABC			4	    South
    
    Desire Result
    
     DOC                   	2   	REGION
     --------------------- 	--- 	--------------
     ABC			4	    South
     DEF			0
    Last edited by Rabbit; Jun 11 '15, 03:51 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...