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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:02:07+00:00 2026-05-27T09:02:07+00:00

I am trying to JOIN multiple tables to the same value in a table.

  • 0

I am trying to JOIN multiple tables to the same value in a table. So I have the table ActivityPartyBase and it has a column PartyId. I want to join COntactId in ContactBase table to PartyId and AccountId in AccountBase table to PartyId. This is the code I am using and it doesn’t return anything. If I only join one it works. Any ideas?

SELECT DISTINCT Appointment.ScheduledStart, ActivityPartyBase.ActivityId
   , Appointment.ActivityId AS Expr1, ActivityPartyBase.ScheduledStart AS Expr2
   , Appointment.Subject, ActivityPartyBase.PartyId, ContactBase.ContactId
   , ContactBase.FullName
FROM Appointment
INNER JOIN ActivityPartyBase
   ON Appointment.ActivityId = ActivityPartyBase.ActivityId
INNER JOIN AccountBase ON ActivityPartyBase.PartyId = AccountBase.AccountId
LEFT OUTER JOIN ContactBase ON ActivityPartyBase.PartyId = ContactBase.ContactId
ORDER BY Appointment.ScheduledStart DESC
  • 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-27T09:02:07+00:00Added an answer on May 27, 2026 at 9:02 am

    Your inner joins are filtering out results because there is no corresponding record on the joined table. I’ve always found the easiest way to debug is to “Select *” and use all LEFT JOINs. This will show you everything in your tables that relates to your main table; you should be able to look at your data and figure out what table is missing a record easily at that point.

    To confirm that this is just a naming convention mismatch,

    INNER JOIN AccountBase ON ActivityPartyBase.PartyId = AccountBase.AccountId
    

    Are PartyID and AccountId the PK/FK?

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

Sidebar

Related Questions

I'm trying to join multiple tables, but one of the tables has multiple records
I'm trying to join the same table in sqlalchemy. This is a minimial version
I have a 3 tables that I'm trying to join and get distinct results.
I'm getting an error when trying to join against multiple tables in a query:
I'm trying to select multiple tables and want to display them as if they
Im probably missing something painfully obvious here. Im trying to join multiple tables together
I am trying to join two tables; the purpose being able to search and
I'm trying to LEFT JOIN two tables, to get a list of all rows
I'm trying to do a join on 2 tables in Zend, using the DbTable
I am trying to model a publications. A publication can have multiple authors and

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.