How to select all columns except empty and whose values ​​are greater than zero? I do this:

query->exec("SELECT latitude,longitude,data FROM \"SchemeObservationLog\".data " " WHERE id_log = "+QString::number(_IdLog)+" AND latitude IS NOT NULL AND latitude > 0 " " AND latitude IS NOT NULL AND latitude > 0"); 

But this request is executed with an error.

Closed due to the fact that off-topic participants Sergey Gornostaev , MaxU , Edward , Kosta B. , kot-da-vinci July 26, 18 at 6:23 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Sergey Gornostaev, MaxU, Edward, Kosta B., kot-da-vinci
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    And with what error it is executed, we think telepaths and without seeing the structure of the table, according to the correct-looking query, predict what the problem is. PS checks on is not null unnecessary. >0 automatically takes only not null - Mike
  • for example, it seems to me strange that your parts in quotes on different lines are not combined by any operators. This is what language, so allows? - Mike
  • @Mike C ++ language. error due to latitude> 0 and latitude> 0. This does not work in Postgresql. - Ivan Triumphov
  • one
    It can not be. Numeric fields can be compared to> 0, write the exact error message that postgress returns. Check the request in pgAdmin. I see only two reasons why checking for more may not work: 1. There is no latitude field in the table 2. The field has some special data type that cannot be compared with numbers - Mike
  • @Mike Yes, you are right. I have these fields were string. - Ivan Triumphov

0