SELECT t1.signout_id AS id1,; t1.claim_id,; t2.* ; FROM signout t1; JOIN signout2 t2; ON t1.signout_id = t2.signout_id WHERE t2.insdttm IN ( ; SELECT MAX(t2.insdttm) FROM signout2 t22 ; WHERE t22.signout_id = t2.signout_id)>I have a table1 (PK=signout_id) and a table2 (PK=sgnout2_id,FK=signout_id)
>SELECT table1.signout_id as id1,; >table1.claim_id,; > MAX(table2.insdttm),table2.*; > from signout table1; > inner JOIN signout2 table2; > ON table1.signout_id=table2.signout_id; > GROUP BY 1,2 >>