SQL conditional union

前端 未结 1 1929
谎友^
谎友^ 2021-02-12 22:00

Question: I have an SQL function which returns a list of files

now I should join an additional list to that list with an union, but only if the user is admin.

Is

1条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-12 22:59

    SELECT  *
    FROM    table1
    UNION ALL
    SELECT  *
    FROM    table2
    WHERE   @isAdmin = 1
    

    0 讨论(0)
提交回复
热议问题