-2
I have a normal query:
select * from TABELAS
Where (AlvaraNumero <> '0')
and ( AlvaraValidade <> '0000-00-00' )
and ( AlvaraAnexo is NOT Null )
and ( AcidenteNumero <> '0')
and ( AcidenteValidade <> '0000-00-00' )
and ( AcidenteValidade <> '0000-00-00' )
and ( SeguroNumero <> '0')
and ( SeguroValidade <> '0000-00-00')
and ( FinancasValidade <> '0000-00-00')
and ( FinancasAnexo is NOT Null)
and ( SocialValidade <> '0000-00-00')
and ( SocialAnexo is NOT Null)
and ( RemuneracaoValidade <> '0000-00-00' )
and ( RemuneracaoAnexo is not Null)
and ( InstaladorNumero <> '0')
and ( InstaladorValidade <> '0000-00-00' )
and ( InstaladorAnexo is Not Null)
and ( MedicaValidade <> '0000-00-00')
and ( MedicaAnexo is Not Null)
order by tb_trabalhador.id asc
How to add to all fields that have Validity at the end because they are dates that cannot be Null or have already passed the date of today?
If you are past the date you can no longer appear in this query.
Are you using any high-level language or is it just SQL?
– Jorge B.
I am using SQL. The simplest.
– ChrisAdler
It was not said which DBMS, but : use a DATE type for the columns of dates , if the BD has use CHECK CONSTRAINTS or TRIGGERS for validations of the date type smaller/larger than the current , use the CONSTRAINT NOT NULL some mandatory fields.
– Motta
MSQL WORKBENCH 6.0
– ChrisAdler
the answer below is not enough for what you want? Could you give more details about what does not meet?
– Rafael Leonhardt