'Searching for a value from all of my SQL table
I am using PostgreSQL and I would like to get row/rows(depending on the query), by giving it a value and searching all of the available columns of my table.
How would I go about checking every column for a value ? I also am looking at checking for different types of values
Solution 1:[1]
If the columns are a and b and the text you are searching for is 'test' then something like this will do the trick:
select *
from table1
where 'test' in (a, b);
Note: this will only work if all your columns have the same datatype and the same datatype with the value you search for.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | VBoka |
