1
Next is the following case:
Tb_importacao [cod_titulo,data,imp_situacao]
cod_titulo data_imp situacao
1 2015-04-10 1
1 2015-04-11 2
1 2015-04-11 1
1 2015-04-13 2
1 2015-04-14 3
1 2015-04-14 4
I need the biggest date that has situation 1 where data_imp < 2015-04-13
.
My real table allowed more than one cod_titles...
Vlw!
And what is the doubt?
– Renan Gomes
SELECT MAX(data_imp) FROM tb_importacao WHERE data_imp < '2015-04-13' AND situacao = 1
?– Rafael Withoeft
– Raphael Araujo
Raphael, just edit sql, can test again?
– Rafael Withoeft
Rafael: so I only bring the longest date I need it by cod_title
– Raphael Araujo
It is that you have not provided all the information in the question... so we will go on the kick, can edit it and provide a detailed explanation of what you want and maybe an example of the expected end result?
– Rafael Withoeft
data_target = 2015-04-13 situaca_target = 1 Expected result cod_title data_imp situacao 1 2015-04-11 1
– Raphael Araujo
Raphael, you can edit your question at the link (edit) below it, or here: http://answall.com/posts/58826/edit
– Rafael Withoeft
Is there anyone who can help with this question of dates? http://answall.com/questions/120596/comor-fazer-um-sql-que-consulte-apenas-dia-de-umdata
– Gladison Neuza Perosini