In article <5070907604510540.wa.ron5174gmail....@bama.ua.edu>,
 ron5...@gmail.com (Ron Thomas) wrote:

> 
> The issue is i need to get the the 1'st record , the problem is i belive in 
> the last "AND" . could some one let me know where teh issue is ?

> Below is the sample table struct & the query i am using
> 
> SELECT A.ALFCD,A.BFLCD
> FROM BAA.LFT  A
> 
>    WHERE  A.EMPNO = 10412
>    AND    A.TYPCD = ' '
>    AND    A.PAYDT = 
>                 (SELECT DISTINCT MAX(B.PAYDT)
>                    FROM BAA.LFT B
>                    WHERE B.PLNYR >=2012
>                  AND B.EMPNO = A.EMPNO
>                  AND A.PAYDT <= '2012-01-30' )

Doesn't the SELECT DISTINCT MAX(B.PAYDT) cause it to select the record 
with PAYDT 2012-01-21?
-- 
Matt Simpson -- University of Kentucky
m...@uky.edu  -- (859) 257-2243
630 S Broadway, Lexington, KY 40506

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to