Hi could someone explain to me this sub query. The first select station is what I don't really understand why set it up this way?
Select n.doc, ISNULL(PendinDDS,0) as PendinDDS
from Nation n
Left Join
(Select t.Doc, ISNULL(Count(T.cossn), )) AS PendinDDS
From (select max(SeqNum) as SeqNum, clms
from T2Nation
group by clms)a
Left Join
T2Nation t on a.SeqNum = t.SeqNum and a.clms=t.clms
where dib_mvt = 'r' and t.SeqNum is not null
group by doc)b
on n.doc = b.doc
Select n.doc, ISNULL(PendinDDS,0) as PendinDDS
from Nation n
Left Join
(Select t.Doc, ISNULL(Count(T.cossn), )) AS PendinDDS
From (select max(SeqNum) as SeqNum, clms
from T2Nation
group by clms)a
Left Join
T2Nation t on a.SeqNum = t.SeqNum and a.clms=t.clms
where dib_mvt = 'r' and t.SeqNum is not null
group by doc)b
on n.doc = b.doc