with temp as(
select a.fk_audit_inserimento
from mtd.t_mtd_all_dt_elab_etl a,mtd.t_mtd_all_dt_anag_etl b
where a.fk_etl_caricamento=b.pk_etl_caricamento
and b.sds_livello='DMT' and b.sds_nome_etl='JOB_DM_MOBILE_CODE'
order by 1 desc
limit 2
)
select
case
when
(select count(*) from temp)=1
then
(select 19000101000000,
union
select fk_audit_inserimento from temp)
when
(select count(*) from temp)=2
then (select fk_audit_inserimento from temp)
end
我想要那个
If count (*) of TEMP =1
然后我想要两条记录19000101000000
和select fk_audit_inserimento from temp;
If count(*) of TEMP =2
然后我想要select fk_audit_inserimento from temp.
但我有
错误:多行。
我如何解决它?
感谢
答案 0 :(得分:1)
尝试以下几点:
SELECT 19000101000000
WHERE (SELECT count(*) FROM temp)=1
UNION
SELECT fk_audit_inserimento FROM temp ;