I have two columns with dates and times. I would like to get all the data from another table that is between the times in column ort and ocas. For example, all the data between: 1/1/2012 9:04 AM to 1/1/2012 6:12 PM AND 2/ 1/2012 9:04 to 1/2/2012 18:13 etc
select * FROM camarinas
WHERE data
between (select ort from ort_ocas)
and (select ocas from ort_ocas);
Error Code: 1242. Subquery returns more than 1 row
SELECT * FROM camarinas
WHERE `data` IN (
SELECT DISTINCT `data` FROM camarinas
JOIN ort_ocas
ON `data` BETWEEN Ort AND Ocas
);
Error Code: 2013. Lost connection to MySQL server during query 30.016 sec