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 8997023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:49:57+00:00 2026-06-15T23:49:57+00:00

I have a table like this : Id int Not Null PK Unique RequestNO

  • 0

I have a table like this :

Id              int      Not Null  PK Unique
RequestNO       int      Not Null   
RefrenceId      int      Null                  //Self Join to Id

If I have these records in this table :

Id   RequestNO    RefrenceId      
1       H100         NULL
2       H101         NULL
3       H101          2
4       H101          3
5       H100          1
6       H105         NULL

Depend on these records I want to return a list where Id is in { 4 ,5 , 6 }.I want to select last childrens (If any parents have not childs, itself is a child). Is there any one to help me about this ?!!

I am using EF 4 (Database First) , and the table name is Requests

UPDATE1 : I try this , but it failed.

var list = DataContext.Requests.GroupBy(rec => new { rec.ConfirmNo }).Select(rec => rec.FirstOrDefault());

If you need more details comment me.
Thanks
Ali Foroughi

  • 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-06-15T23:49:58+00:00Added an answer on June 15, 2026 at 11:49 pm

    You can try this:

    var list = DataContext.Requests.Where(op => !DataContext.Requests.Any(ip => ip.RefrenceId == ip.Id));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL table that looks like this: `id` int(10) unsigned NOT NULL
I have a table defined like this: CREATE TABLE mytable (id INT NOT NULL
So I have a table like this: create table `test` ( `testId` int(11) not
I have a table OrganisationStructure like this: OrganisationID INT ParentOrganisationID INT OrganisationName VARCHAR(64) 1
Assume I have a table like this: column A(int) column B(int) 1 2 2
I have a table that looks like this: ID (pk,int) Col1 (nvarchar) Col2 (nvarchar)
I have two tables which looks something like this Table Queue int ID; string
I have something like this: create table account ( id int identity(1,1) primary key,
I have a testdata like this: DROP TABLE SELECT_PASS; CREATE TABLE SELECT_PASS(ID INT(20),TESTCASE VARCHAR(20),RESULT
I have a MySQL table like this CREATE TABLE IF NOT EXISTS `vals` (

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.