SQL: Return “true” if list of records exists?

后端 未结 14 805
情深已故
情深已故 2020-12-28 12:49

An alternative title might be: Check for existence of multiple rows?

Using a combination of SQL and C# I want a method to return true if all products in a list exist

14条回答
  •  轮回少年
    2020-12-28 13:19

    Here's how I usually do it:

    Just replace your query with this statement SELECT * FROM table WHERE 1

       SELECT
          CASE WHEN EXISTS 
          (
                SELECT * FROM table WHERE 1
          )
          THEN 'TRUE'
          ELSE 'FALSE'
       END
    

提交回复
热议问题