hola, disculpa por no haberte entendido bien,
Mira, lo que necesitas es validar sobre los resultados obtenidos, por lo tanto tu condicion debe estar puesta un nivel más arriba del select, hacer algo de este estilo:
Código PHP:
if (
select count(distinct str(datepart(year, fecha))+str(datepart(year,fecha))+str(datepart(day, fecha)))
from tabla
where fecha between '20071212' and '20071212 23:59:59.999'
or fecha between '20071214' and '20071214 23:59:59.999'
) < 2 --o los dias que van en el select
begin
select *
from tabla
where fecha between '20071212' and '20071212 23:59:59.999'
or fecha between '20071214' and '20071214 23:59:59.999'
end
else
select * from tabla where 1=0
o validar en la aplicacion
saludoss