Building a web site in C# and using sql server ...
Its a web site where devices can be loaned to people and once they use it they return it back.
I have a Device table which has the fields DeviceID,DeviceName,Office,SentDate, ReturnDate. The composite primary key is DeviceID and SentDate.
Eg of 4 records=> DeviceID:DeviceName:Office:SentDate:ReturnDate
If the device is not returned the returnDate could be either null or blank as inrecord 5.
I need to extract all the devices that are there in the table but only 1 record for each device with the latest record, so the result set would be like this
When I tried a groupby, it says cannot aggragate DeviceName etc...
Can some body provide me the sql query to achieve this.
Thanking in advance..
View Complete Post