SELECT [:fields:] 
FROM 

	day_month as dd LEFT JOIN v_awbstat_congruity AS qt 
		ON dd.Val = qt.DayIns AND qt.YearIns = YEAR(@date) AND qt.MonthIns = MONTH(@date)
			LEFT JOIN vettori AS v ON qt.vettore_id = v.id

WHERE dd.Val >= 1 AND dd.Val <= DAY(LAST_DAY(@date))
 [:param:] GROUP BY 
[:groupby:]
ORDER BY dd.Val