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 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 have a Git repository that I want to remove all previous commits from.
Continuing from my previous question , is there a comprehensive document that lists all
All the articles I've found via google are either obsolete or contradict one another.
I have a collection of divs that contain either images or checkboxes. My end
I have a data table (will be millions of records but I will make
All the recent VisualSVN Server posts made me want to check it out. I
All front-end developers know the pain of coding for Firefox, then viewing our then
All I know about the constraint is it's name ( SYS_C003415 ), but I
All I want is to be able to change the color of a bullet
All throughout an application wherever error messages (or other user messages) are used I

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.