I am trying to do lookup cross 2 tables using Entity Framework unfortunately I couldn’t find way but I do have sql query which does what I want
SQL Query
select top(1) p1.Percentage
from LookupTable p1 , [lookupTablePerUnit] p2
where p2.[LookupValue] <= @Value1 and p1.ID=p2.[LookupID]
order BY pr.range DESC
if @Value1= 6 then The result = 52
Here is a screenshot of two tables (lookupTable && LookTablePerUnit) using this query
(SELECT * FROM [DB].[dbo].[lookupTablePerUnit] p1 , [DB].[dbo].[LookupTable] p2
where p1.LookupTableID = p2.ID)
A join (your query is using the implicit join syntax for SQL) would look very similar in Linq to Entities:
Had to take a guess on the
rangeproperty you have a typo in your question so its not clear whether it can be attributed toLookupTableorlookupTablePerUnit