Skip to content
Advertisement

How to a check column exits in a table in SQL drill query

SELECT t1.customerInformation.customerid AS CustomerId
FROM EndUserNotificationHistoryEvent t1
WHERE t1.operationType <> 'DELETE';

In this above query where condition should be executed only when operationType column is present in the table. If operationType column is not present where condition is no needed.

Advertisement

Answer

Try This:

SELECT t1.customerInformation.customerid AS CustomerId
FROM EndUserNotificationHistoryEvent t1
WHERE (t1.operationType <> 'DELETE' OR t1.operationType IS NULL)
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement