• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Exclude null value from comparison across columns

Resolved: Exclude null value from comparison across columns

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

Imagine this table:
I would like to add a column that tells me if all not-null values of the row match.
So the ideal output is:
I have tried:
But would return false for all due to the null values.
What is the best way to achieve the output above?

Answer:

You could transform the columns to rows, the count the distinct values. That will automatically ignore NULL values:
If you don’t want to list all columns manually, you can use some JSON magic to turn the columns to rows in order to count the distinct values:

If you have better answer, please add a comment about this, thank you!

boolean-logic case null postgresql sql
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Shopware 400 Status Error “This value is too long. It should have 255 character or less.” When I Try Updating Database Table

01/04/2023

Resolved: Using AWK to count multiple patterns in a file

01/04/2023

Resolved: significance letter above bar graphic in wrong order

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.