Ich stehe ein Problem in der Update-Klausel. Ich versuche, die unten zu tun:Problem mit dem Update Cluase
update AM1 from DB.AM_7541 AM1,
(sel distinct TRIM(SB.LCDBDN) NEID, trim(leading '0' from sb.lcdmno) LCDMNO,
AM.Netw_equip
from
DB1.PLTL SB
inner join DB.AM_7541 AM
on trim(leading '0' from sb.lcdmno)=AM.accs_meth_num
where SB.LOAD_DATE in (sel max(load_date),lcdmno,lcdbdn from DB1.PLTL where lcdmno not like ' ' and lcdmno is not null group by lcdmno, lcdbdn)
and SB.LCDBDN not like ''
) der
set Netw_equip=der.NEID
where AM1.accs_meth_num=der.lcdmno
Ich muss nehmen Sie die max (load_dt) gruppiert auf lcdmno und lcdbdn. Ich bekomme Fehler wie zu viele Ausdrücke in der Select-Klausel.
Können Sie mir bitte dabei helfen.
für dups Suche:
sel NEID, LCDMNO, COUNT(*) from
(
sel distinct TRIM(SB.LCDBDN) NEID, trim(leading '0' from sb.lcdmno) LCDMNO,
AM.Netw_equip
from
DB1.PLTL SB
inner join DB.AM_7541 AM
on trim(leading '0' from sb.lcdmno)=AM.accs_meth_num
where SB.LOAD_DATE in (sel max(load_date),lcdmno,lcdbdn from DB1.PLTL where lcdmno not like ' ' and lcdmno is not null group by lcdmno, lcdbdn)
and SB.LCDBDN not like '')
group by 1,2
having count(*)>1
--- 0 Zeilen Danke, Amit
Sie müssen 'NEID' entfernen, wenn Sie nach Duplikaten suchen. – dnoeth