Help mount select

Asked

Viewed 25 times

-1

Product Table

TB_PRODUTO:
CODIGO PRODUTO  ST_PRODUTO DT_ENTRADA
 1100  NOTEBOOK    0       20/05/2019
 1200  NOTEBOOK    1       21/05/2019
 1300  NOTEBOOK    2       22/05/2019
 1400  NOTEBOOK    0       23/05/2019
 1500  NOTEBOOK    2       24/05/2019
 1600  NOTEBOOK    3       25/05/2019

Good evening, I would like to make a select in the product table above to return me the laptops with ST_PRODUTO different 0, however if the date of entry is greater than '21/05/2019' I want to return the ST_PRODUTO 0 which are after that date.

1 answer

0

An alternative is:

Select *
From TB_PRODUTO
WHERE (DT_ENTRADA >= '2019-05-21' AND ST_PRODUTO = 0)
OR (DT_ENTRADA < '2019-05-21' AND ST_PRODUTO <> 0)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.