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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:21:20+00:00 2026-05-13T14:21:20+00:00

All previous attempts at a JOIN have left me with either the disc or

  • 0

All previous attempts at a JOIN have left me with either the disc or item data populating the id, title keys of the result (maybe a clash is occuring).

So I have:

item table
fields: id, title

disc table
fields: id, title

item_disc table
fields: item_id, disc_id

How do I construct a double join so that I can access the related discs to an item. At present I am running two seperate queries, one for a single item record, then one for array of discs.

Apart from it being easier to do in one query with joins, if I ever want to retrieve more than 1 record, I would currently need to be running 2 queries per item as I cannot join my data.

Please help!! I feel this is my final many to many hurdle (though dare not speak too soon).

  • 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-13T14:21:21+00:00Added an answer on May 13, 2026 at 2:21 pm

    because both item and disc have columns named id and title, they will overwrite each other. you would need to use as to distinguish them…

    for all items and their associated discs:

    select m.*, i.title as item_title, d.title as disc_title
    from item i, disc d, item_disc m where i.id = m.item_id and
    d.id = m.disc_id order by i.title, d.title
    

    for one item and its discs:

    select m.*, i.title as item_title, d.title as disc_title
    from item i, disc d, item_disc m where i.id = m.item_id = ? and
    d.id = m.disc_id order by d.title
    

    replace ? with the item you want

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

Sidebar

Related Questions

I just want what my title says.I have already read all the previous similar
I have already read all the previous similar posts but I couldn't find a
I have a problem with my application. First of all on a previous page
I have the below XAML which attempts to set the border of all TextBoxes
if i click on any checkbox all previous checkboxes must get checked my logic
When I create a comment in my feed, rails is duplicating all the previous
Starting from this official statement that all xyAndroid versions previous API 11 doesn't support
Thanks to all that responded to my previous thread. There is still a problem
On my previous job, providing all methods with javadoc was mandatory, which resulted in
Hi all, as you see in previous brush there is lines in the middle,

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.