I am trying to figure out a way using linq to get the most recent records from a database. All of the fields in the table are varchar2.
For example I have a table:
CODE VERSION FIELD1 FIELD2 ...
AAA 0.0.1 data1 data2
BBB 0.0.2 data22 xxxxx
AAA 0.0.2 xxcxcx asdasdas
AAA 0.0.3 data11 data5555
BBB 0.0.2 dasds aasdasd
I would like only to return.
AAA 0.0.3 data11 data5555
BBB 0.0.2 dasds aasdasd
I could bring all the data back ordering by CODE/VERSION then take the top 1 for each unique code. However that seems like I'm adding overhead. Is there a simpler way to accomplish this?
EDIT: I am using Oracle 11g. I have no control on the current DB the fields are what they are. I am trying LINQ-Entities and the Code and version are the keys to the table.