Here is what I have guys/girls...I have 3 tables as follows (only included important columns):
ITEMS:
ItemId Name ItemLocationId
20 Portal Orange 12
21 Portal Blue 13
ITEMLOCATIONS:
ItemLocationid ItemId CreateDate LocationIf
13 21 3/26/2017 2:19:15 AM 5
14 20 3/27/2017 6:25:45 PM 6
15 21 3/31/2017 12:17:25 AM 6
16 21 3/31/2017 12:18:42 AM 5
17 21 3/31/2017 12:20:23 AM 6
LOCATIONS
LocationId Name
5 Storage Room
6 Boss Room
My issue lies in the itemlocations table...I only need the most recent ItemLocation in the table...The others are for historical value...here is the query I am running now
Dim i = From r In mydb.Items
Join il In mydb.ItemLocations On r.ItemLocationId Equals il.ItemLocationId
Join l In mydb.Locations On il.LocationId Equals l.LocationId
Where r.CompanyId = UserPro.CompanyId
Select r.ItemId, r.Name, Location = l.Name
this is returning the first itemlocation in the table for that item...how do I get only the one with then most recent