I have a tableA which have 50 columns. 5 out of them are NOT NULL and other 45 can be NULL. now. there is addition 51st column of status.
I want to flag the record as a "failure" in status when col6-col50 are empty.
col1-col5 are always populated. but Lets say from col6-col50 are all null values, then flag the record as a failure in status.
Okay I know the lengthy way.
update ..
...
where (col6 is null and col7 is null and.....)
Is there any other possible shorter and efficient way ? Thanks
Not much better, but
update ..
...
where COALESCE(
col6,
col7,
...) IS NULL
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.