Basta anche fare così :

Codice PHP:
$sql9 mysql_query("SELECT COUNT(giorni.trasferta) FROM giorni WHERE giorni.giorno BETWEEN '$data1' and '$data2' and giorni.trasferta='1'") or die(mysql_error()); 
echo 
$sql9

no??????????