1
I am having a problem when making a query using between with Internet, the query is simply not working, it returns the results as if the between was not in the query. What I’m doing wrong?
SELECT * FROM usuarios INNER JOIN matriculas ON (matriculas.idaluno = usuarios.id) WHERE matriculas.idcurso = :idcurso AND matriculas.data BETWEEN :dataini AND :datafim ORDER BY usuarios.nome ASC LIMIT 0,20
I’m putting everything straight, including the dates I’m putting on the American standard Y-m-d which is what the between operator accepts. Without using Inner Join, the query works well.
It is worth remembering that I am using.
This consultation is more wrong than my kkkk
– Leandro Silva Campos
Operator between has to be after Where, it doesn’t make sense the way you put it
– Leandro Silva Campos
@Leandrosilvacampos you are mistaken, the operator
BETWEEN
does not need to be after theWHERE
. Do the following, put the structure and data of these two tables in Sqlfiddle: http://sqlfiddle.com/– Roberto de Campos
look vlw for trying to help but definitely this was not the problem, because I tested the way you spoke and did not return any result that way. But I already managed to fix it, my problem was in the values of the consultation
– Leandro Silva Campos