Display SQL results with specific field filters

Asked

Viewed 47 times

0

I have the SQL:

select id,disponibilidade,tipo from clientes where cliente = '$cliente' AND status = '2' AND tipo = '0' OR disponibilidade <> '0' OR vanual <> '0' OR vtemporada <> '0'

You have to return record if the field guy is equal to zero and if all fields availability, vanual and vtemporada are zero. But... will not return record if the capo guy is different from zero and also if any of the fields like availability, vanual and vtemporada are different from zero.

But I can’t do it!

1 answer

0

Must return record if the type field is equal to zero and if all fields availability, vanual and vtemporada are zero.

tipo = 0
disponibilidade = 0
vanual = 0
vtemporada = 0
RETORNA OK

But... will not return record if the capo type is non-zero and also if any of the fields as availability, vanual and vtemporada are different from zero.

SELECT id,disponibilidade,tipo 
  FROM clientes 
 WHERE cliente = '$cliente' 
   AND status = 2 
   AND tipo = 0
   AND disponibilidade = 0 
   AND vanual = 0 
   AND vtemporada = 0

I just don’t understand the "status" field, but it should work.

Browser other questions tagged

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