A
A
alex995052021-07-07 00:30:54
MySQL
alex99505, 2021-07-07 00:30:54

How to add a condition on a value from a select?

There is a conditional selection:
select field1, field2, "prod" as env from table

We need to add a condition on the "env " column:
select field1, field2, "prod" as env from table where env = "prod"

Tell me how to implement this correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pLavrenov, 2021-07-07
@pLavrenov

Um..
select field1, field2, env from table where env = "prod"

E
Emil Revencu, 2021-07-07
@Revencu

And what for to filter through where if in a column "env" all values ​​are equal "prod"?
Maybe so ?

select t.* from (select field1, field2, "prod" as env from table) as t where t.env = "prod"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question