SELECT `p`.`pressure`, `t`.`temperature`, `h`.`humidity`
FROM (
SELECT `DATA_SENSOR` AS `pressure`
FROM `bmp_pressure`
WHERE `DATESTAMP` <= :dateTime
ORDER BY `DATESTAMP` DESC
LIMIT 1
) AS `p`
JOIN (
SELECT `DATA_SENSOR` AS `temperature`
FROM `bmp_temperature`
WHERE `DATESTAMP` <= :dateTime
ORDER BY `DATESTAMP` DESC
LIMIT 1
) AS `t`
JOIN (
SELECT `DATA_SENSOR` AS `humidity`
FROM `humidity`
WHERE `DATESTAMP` <= :dateTime
ORDER BY `DATESTAMP` DESC
LIMIT 1
) AS `h`
SELECT `p`.`hour`, `p`.`pressure`, `t`.`temperature`, `h`.`humidity`
FROM (
SELECT HOUR(`DATESTAMP`) AS `hour`, `DATA_SENSOR` AS `pressure`
FROM `bmp_pressure`
WHERE `DATESTAMP` BETWEEN :date AND :date + INTERVAL 1 DAY
GROUP BY HOUR(`DATESTAMP`)
) AS `p`
JOIN (
SELECT `DATA_SENSOR` AS `temperature`
FROM `bmp_temperature`
WHERE `DATESTAMP` BETWEEN :date AND :date + INTERVAL 1 DAY
GROUP BY HOUR(`DATESTAMP`)
) AS `t` ON `t`.`hour` = `p`.`hour`
JOIN (
SELECT `DATA_SENSOR` AS `humidity`
FROM `humidity`
WHERE `DATESTAMP` BETWEEN :date AND :date + INTERVAL 1 DAY
GROUP BY HOUR(`DATESTAMP`)
) AS `h` ON `h`.`hour` = `p`.`hour`