Home  >  Q&A  >  body text

WHERE condition in SQL query: select `a` not equal to '0'

I have:

`a` int DEFAULT '0'

From the thousands of records I have, I want to select a that do not have a value of 0 or empty.

I tried something similar.

"SELECT * FROM TABLE WHERE (`a` unequal '0' or '') ;"

P粉642436282P粉642436282184 days ago273

reply all(1)I'll reply

  • P粉807397973

    P粉8073979732024-04-04 11:50:46

    Try this

    SELECT * FROM TABLE WHERE (`a` <>'0' or `a` = '' or `a` is null)

    reply
    0
  • Cancelreply