I need compare some dates, my query is getting 3 dates in first query => 2011-09-01, 2011-10-01, 2011-11-01
And 3 dates in second query => 2011-07-01, 2011-11-01, 2011-08-01
因此,我如何比较这些错误,避免这种错误:
Subquery 退回了不止一种价值,在以下数值时,这种价值是不正确的: = ,andlt;=,>> = Or when used as an expression
增 编
SELECT
c_Fk_IdBoleta as Numero_Boleta,
Pregunta (12) as Numero_Pregunta,
El período transcurrido entre siembra y cosecha no corresponde al tipo de cultivo as Detalle_Error
FROM
Clt_Sembrado as sembrado
WHERE
sembrado.c_Fk_IdBoleta = 45550711
GROUP BY sembrado.c_Fk_IdBoleta, sembrado.d_MesAnioSiembra, sembrado.d_MesAnioCosecha, sembrado.si_Fk_IdDesglose
HAVING
( SELECT sembrado.d_MesAnioCosecha
FROM Clt_Sembrado as sembrado, Clt_Desglose as desglose
WHERE sembrado.si_Fk_IdDesglose = desglose.si_Pk_IdDesglose
AND sembrado.c_Fk_IdBoleta = 45550711
) > (SELECT DATEADD(Month,6,sembrado.d_MesAnioSiembra)
FROM Clt_Desglose as desglose, Clt_Sembrado as sembrado
WHERE (((sembrado.si_Fk_IdDesglose = desglose.si_Pk_IdDesglose)AND
(desglose.c_Fk_CodCiiu4 = 0112.00
OR desglose.c_Fk_CodCiiu4 = 0111.01
OR desglose.c_Fk_CodCiiu4 = 0111.02
OR desglose.c_Fk_CodCiiu4 = 0113.01
OR desglose.c_Fk_CodCiiu4 = 0113.03
OR desglose.c_Fk_CodCiiu4 = 0113.05
OR desglose.c_Fk_CodCiiu4 = 0113.06
OR desglose.c_Fk_CodCiiu4 = 0113.07
OR desglose.c_Fk_CodCiiu4 = 0113.08
OR desglose.c_Fk_CodCiiu4 = 0113.10
))
AND sembrado.c_Fk_IdBoleta = 45550711))
下表: 问题在于在表Blt_Sembrado中可以插入“一”或“二读”时间,我需要证实,“MesAnioCosecha”的情况较少(d_MesioAnSiembra + 6个月)。 页: 1