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

  • SEARCH
  • Home
  • 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 3491870
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:41:22+00:00 2026-05-18T11:41:22+00:00

I have PM Inbox and 2 Tables: Users and Admins. I have this query:

  • 0

I have PM Inbox and 2 Tables: Users and Admins.

I have this query:

            return (from pm in dc.PrivateMessages
                   join user in dc.Users
                   on pm.Sender equals user.UserID
                   select new PMInbox
                                 {
                                     SenderUsername = user.Username
                                 }).ToList();

But there I can only have all PMs from User-Senders.

Which kind of join I must add here to have pm.Sender == user.UserID OR pm.Sender == admin.AdminID?

  • 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-18T11:41:23+00:00Added an answer on May 18, 2026 at 11:41 am

    Logically, that’s something like this:

    var messageUsers = dc.PrivateMessages.Join(dc.Users,
                                               pm => pm.Sender,
                                               user => user.UserId,
                                               (pm, user) => user);
    var messageAdmins = dc.PrivateMessages.Join(dc.Users,
                                               pm => pm.Sender,
                                               admin => admin.AdminID,
                                               (pm, admin) => admin);
    return messageUsers.Union(messageAdmins)
                       .Select(user => new PMInbox {
                           SenderUsername = user.Username
                        })
                       .ToList();
    

    Or you could just make it a cross-join with a where clause:

    return (from pm in dc.PrivateMessages
            from user in dc.Users
            where pm.Sender == user.UserID || pm.Sender == user.AdminID
            select new PMInbox
            {
                SenderUsername = user.Username
            }).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables Inbox(id,accountid,emailfrom,emailsubject,emailbody,emaildate,attachment) Trash(as above) When a user wants to delete a
I have page part like this <div id=inbox> <h1>Headline</h1> <p>First paragraph</p> <table> <tbody> <tr>
I'm trying to retrieve Inbox items from a specific mailbox (in which i have
I have 3 tables; Inbox, Outbox, and Messages. For a single message, the data
On my user inbox from my user messaging system I am building a feature
I have a query on Cursor. Cursor cursor = contentResolver.query( Uri.parse( content://sms/inbox ), null,
Many websites have the concept of sending messages from user to user. When you
I have a mail reading service that reads every email from an inbox, parses
I have created an inbox system. Signed in user can message other signed in
I have a named route to the user's inbox, which is maintained by 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.