Add column to SQL query results

前端 未结 2 686
故里飘歌
故里飘歌 2021-02-12 20:17

I\'m putting together a report in SSRS. The dataset is populated with a SQL query of an MS SQL server. It\'s querying several similar tables using Union All. The problem is that

2条回答
  •  孤独总比滥情好
    2021-02-12 20:41

    why dont you add a "source" column to each of the queries with a static value like

    select 'source 1' as Source, column1, column2...
    from table1
    
    UNION ALL
    
    select 'source 2' as Source, column1, column2...
    from table2
    

提交回复
热议问题