Anyone know if I can make a reverse Between?
Something like this:
SELECT *
FROM TABLE
WHERE '01-01-2014' BETWEEN 'field1' AND 'field2';
SELECT * FROM TABLE WHERE
TO_DATE('01-01-2014', 'DD-MM-YYYY')
BETWEEN
TRUNC(field1) AND TRUNC(field2);
Above query assumes your field1 and field2 belong to the "DATE" datatype.
Incase, field1 and field2 are strings then, your select query should be
SELECT * FROM TABLE WHERE
TO_DATE('01-01-2014', 'DD-MM-YYYY')
BETWEEN
TO_DATE(field1,'DD-MM-YYYY') AND TO_DATE(field2,'DD-MM-YYYY');
EDIT:
In oracle, && is not valid, use AND instead.
For date comparision as string, you are using "YYYY-MM-DD" which would be valid, however, it is better to use TO_DATE Function since I assume data_expiracio would be a "DATE" datatype.
SELECT grups.nom as grup, categoria.nom as categoria, zona.nombre as zona, ofertes.* FROM (((ofertes LEFT JOIN grups ON ofertes.id_grupo = grups.id) LEFT JOIN categoria ON ofertes.idcategoria = categoria.id) LEFT JOIN zona ON ofertes.idzona = zona.id) WHERE
estat=1
AND
data_expiracio >= TO_DATE('2014-06-10' , 'YYYY-MM-DD')
AND TO_DATE(2014-06-04,'YYYY-MM-DD') BETWEEN
TRUNC(dataoferta) AND TRUNC(datavenciment) ORDER BY datavenciment ASC