# LINQ queries to fetch first and last name

I have these two queries and they work just fine. I use the values they retrieve to populate a title for a view in my application. It seems though that I should be able to accomplish this with one query and I do not know how.

Dim firstName = (From row In db.ItemDetails
Where row.Unique_Location_ID = locationID And row.Item_Type_Identifier = 1 And _
row.Category_Attribute_Identifier = 2
Select CStr(row.Value)).FirstOrDefault()

Dim lastName = (From row In db.ItemDetails
Where row.Unique_Location_ID = locationID And row.Item_Type_Identifier = 1 _
And row.Category_Attribute_Identifier = 3
Select CStr(row.Value)).FirstOrDefault()

ViewBag.assignedTo = ("Employee this item is currently assigned to: " + firstName + " " + lastName + ".")


Is there a better way to do this?

You can achieve this by using the group by clause to create an aggregated list constrained by Unique_Location_ID and Item_Type_Identifier. To make the query more readable, store the names in local variables using the let clause.
Dim name As String = (

I also advice you to not use underscores in public members as suggested in the .net general naming conventions. So, if possible, rename the members to UniqueLocationID, ItemTypeIdentifier and CategoryAttributeIdentifier.