求最在值问题.为什么不对呢.请帮忙看看.谢谢了!
select Max(kian_date) as MaxKianDate from
(
(
(
select a.KIAN_DATE as KIAN_DATE from RINGI_TBL a,RINGIMEISAI_TBL b,FAVORITES_TBL c where
c.SYSYNO=a.KIANSYA_CODE and c.KANRISYA_CODE=b.KAIGISYA_CODE and a.ID=b.ID
)
Union
(
select d.HOKOKU_DATE as KIAN_DATE from HOKOKU_TBL d,HOKOKUMEISAI_TBL e,FAVORITES_TBL f where
f.SYSYNO=d.HOKOKUSYA_CODE and f.KANRISYA_CODE=e.KAIGISYA_CODE and d.ID=e.ID
)
)
) as tt group by tt.kian_date
[解决办法]
select
Max(kian_date) as MaxKianDate
from
(select a.KIAN_DATE as KIAN_DATE
from RINGI_TBL a,RINGIMEISAI_TBL b,FAVORITES_TBL c
where c.SYSYNO=a.KIANSYA_CODE and c.KANRISYA_CODE=b.KAIGISYA_CODE and a.ID=b.ID
Union
select d.HOKOKU_DATE as KIAN_DATE
from HOKOKU_TBL d,HOKOKUMEISAI_TBL e,FAVORITES_TBL f
where f.SYSYNO=d.HOKOKUSYA_CODE and f.KANRISYA_CODE=e.KAIGISYA_CODE and d.ID=e.ID) as tt