Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to get the latest row in a MS SQL server for a specific value??

$
0
0

Hi,

This is one of the transaction tables i need for my application.

DeptEmp

d005b001

d003b002

d004b003

d005b002

d002b001

d005b004

The values in the table are inserted after enough time gap, one after the other. 

I want to find out the latest value that is stored for a specific record.  

Like, for example, i have "select emp from <table> where dept = "d005""

This gives me b001, b002 and b004. But i want to get the latest entry, i.e., b004 as my answer.

Thank u.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>