Erweitern wir die Abfrage noch:
PHP-Code:
<?php
$sql = "SELECT
COUNT(id) AS amount
FROM
tabelle
WHERE
(date_from <= '{$timestamp_date_from}' AND
date_to >= '{$timestamp_date_from}') OR
(date_from <= '{$timestamp_date_to}' AND
date_to >= '{$timestamp_date_to}') OR
(date_from > '{$timestamp_date_from}' AND
date_to < '{$timestamp_date_to}')";
?>