2
Guys, here’s the thing, I’m having to do a select in a bank, where I should look for values that exist between two dates, and that have a specific user. I made the select so:
SELECT * FROM `tabela` WHERE `data` BETWEEN 'dataInicio' AND 'dataFim' AND `usuarioID` = 0 OR `adminID` = 2
With this should appear me as a result 2 records containing the user adminID = 2 in the searched period (I launched random values to test). Only instead of appearing 2 records, returns all the records that the adminID is, regardless of the date search interval. I tested the command directly in the Mysql database, and if I split the query in
SELECT * FROM `tabela` WHERE `data` BETWEEN 'dataInicio' AND 'dataFim'
and
SELECT * FROM `tabela` WHERE `usuarioID` = 0 OR `adminID` = 2
both are working properly, which may be happening when I put them together?
PS: Now that I’ve started learning databases, then if I’ve done something really stupid, please disregard it.
Thanks, I really hadn’t thought of that. Thank you
– user2955968