sql server - SQL query last transactions -


enter image description here

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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -