0
Personal I have a table where I list purchases of customers, in this table I have information as the id of the shopkeeper and the status of the order, this status goes from 0 to 6, however I would like to display only when the status is up to 5, I am trying this way
SELECT * FROM tbl_compras WHERE loja_id="& lojista_id &" OR status=0 OR status=1 OR status=2 OR status=3 OR status=4 OR status=5 ORDER BY status ASC LIMIT 20
But end up returning me all the results of other shopkeepers and I just want a specific shopkeeper.
Where am I going wrong?
You need to encapsulate between parentheses the two conditions.
– Bruno Warmling
The first OR seems to be wrong, use the IN < ...loja_id="& lojista_id &" and status in (1,2,3,4,5) ... >
– Motta