-1
I have a problem with a query because I ask to show me all fields that a certain condition that in a column is written 'Lisbon', but the result is: Lisbon and port.
Query:
Select * From tb_trabalhador WHERE (AlvaraNumero = 0 or AlvaraNumero is NULL) or
(AlvaraValidade='' or AlvaraValidade is Null or AlvaraValidade='0000-00-00') or (AlvaraAnexo='' or AlvaraAnexo is Null)
or AcidenteNumero = 0 or (AcidenteValidade='' or AcidenteValidade is Null or AcidenteValidade='0000-00-00')
or (AcidenteAnexo='' or AcidenteAnexo is Null) or SeguroNumero = 0 or (SeguroValidade='' or SeguroValidade is Null or SeguroValidade='0000-00-00' )
or (SeguroAnexo='' or SeguroAnexo is Null) or InstaladorNumero = 0 or (InstaladorValidade='' or InstaladorValidade is Null or InstaladorValidade='0000-00-00')
or (InstaladorAnexo='' or InstaladorAnexo is Null) AND tb_trabalhador.distrito = 'Lisboa'
We have to be very careful about that sort of thing because
A and b or c
is different(a and b) or c
and different froma and (b or c)
. Very careful with the logical properties.– Jorge B.