Answer the question
In order to leave comments, you need to log in
How to make a query to all rows in the database where the value is, for example, "yes"?
Good day to all, I
apologize in advance for the lamer question,
is it possible in Postgres to request that rows with columns where the column value = 'yes' be shown?
DB:
-----------door1 ---door2 --- door3 Line
1 -- no--------yes-------no
Line 2 -- no - ------ no-------yes
Line 3 -- no------- no-------no
result:
------------ -- ---
1st line ---door2
2nd line -- door3
select door1,door2, door3 from qualitytable WHERE door1,door2, door3 = 'yes';
- this is the wrong request, of course, but something like this is needed.
Answer the question
In order to leave comments, you need to log in
select * from(
select stringid, "door1" val from qualitytable where door1 = 'yes'
union all
select stringid, "door2" val from qualitytable where door2 = 'yes'
union all
select stringid, "door3" val from qualitytable where door3 = 'yes'
)
string 1,2,... = stringid, i.e. there must be some row id.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question