Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7604451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:54:47+00:00 2026-05-30T23:54:47+00:00

I am trying to do lookup cross 2 tables using Entity Framework unfortunately I

  • 0

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)

http://s15.postimage.org/m80zvn4mx/Captur2e.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:54:49+00:00Added an answer on May 30, 2026 at 11:54 pm

    A join (your query is using the implicit join syntax for SQL) would look very similar in Linq to Entities:

    var query = from p1 in context.LookupTable 
                join p2 in context.lookupTablePerUnit on p1.ID equals p2.LookupID
                where p2.LookupValue <= Value1
                orderby p1.range descending
                select p1.Percentage;
    
    var result = query.FirstOrDefault();
    

    Had to take a guess on the range property you have a typo in your question so its not clear whether it can be attributed to LookupTable or lookupTablePerUnit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to figure out an efficient way to join tables and cross reference
I am trying to achieve lookup method injection using a simple example. But, seems
I am trying to figure out a way to query a property feature lookup
I'm trying to do a reversed SQL lookup using Django 1.3. I found a
I am trying to perform a JNDI-lookup from within the GWT devmode. I have
I'm trying to do a xpath lookup on nodes returned by xpath lookup, but
I am trying to code a global lookup table of sorts. I have game
I have a fairly complicated lookup i'm trying to do in Rails and I'm
I'm trying to build a MySQL query that uses the rows in a lookup
I am trying to lookup a value e.g. 123abc456 from a table but the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.