sql server - SQL query last transactions -
you can't see on image have many till_id numbers. (1,2,3,4,5).
what want showing last "trans_num" without repeating till_id.
for example:
till_id trans_num 1 14211 2 14333 3 14555
a typical way is:
select t.* t t.trans_date = (select max(t2.trans_date) t t2 t2.till_id = t.till_id );
Comments
Post a Comment