0
I am populating a chart and for that I need to select the data of each user in the database, table financeiro
. Still don’t want to show field records label_chart
that are empty, nor fields qdade_stream
with a zero value, unless the field label_chart = inicio
(in that case the field qdade_stream
can have zero value).
SELECT * FROM financeiro WHERE id_usuario = 150 AND label_chart !='' AND (qdade_stream != 0 AND label_chart <>'inicio')
ORDER BY order_chart";
The way I am doing, the query does not return the line whose label_chart=inicio
, because its value is zero, the query only obeys the condition of only returning qdade_stream != 0
I tested this code, but there seems to be some error, because it did not return anything, the graph did not even form.
– Eugenio de Castro
I don’t know what SQL implementation you’re using (Mysql, SQL server, ...) so I don’t know if it might be a problem to use
!=
instead of<>
, it might be worth testing it. Otherwise it’s hard to know what might be going on without knowing how your data is.– GMachado
I am using Mysql. I have 4 charts, only this query that can not return what I need, as explained in my statement. Also I can’t know what’s going on. And I don’t understand what you need to know about the database data, because it’s a normal table.
– Eugenio de Castro