Help with a subquery

Giganews Newsgroups
Subject: Help with a subquery
Posted by:  JJ297 (nc2…@yahoo.com)
Date: Fri, 8 Oct 2010

This is what I'm need to get:

To get the Pending Count of COSSN I need to add the following...

1) Use T16pendall table to Count (COSSN), MFT_POSN1_CD = B or D or
(MFT_POSN1_CD = A and AGED_ALIEN_RSW = Y) and COSSN is not = COSSN in
T16pendmvt, and

(2) use T16pendmvt table to Count (COSSN), (MVT_TYP = R and MVT_LOC
not = R** or S** or V**), and

(3) use T16pendmvt table to Count (COSSN) and MVT_TYP = T

So I tried to code them separtely but don't know how to put them
together.

select count(cossn) as cossn
from t16pendall a
join t16pendmvt b on a.cossn = b.cossn
where (MFT_POSN1_CD = 'b' or MFT_POSN1_CD='d')
or (MFT_POSN1_CD = 'a' and Aged_Alien_RSW='Y') and
Cossn not in the t16pendmvt table (don't know how to write this)

select count(cossn) as cossn
from t16pendmvt
where Mvt_typ ='r' and mvt_loc <> 'r%' or mvt_loc='s%' or mvt_loc='v%'

select count(cossn) as cossn
from t16pendmvt
where MVT_Typ ='t'

Replies