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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:06:48+00:00 2026-06-17T16:06:48+00:00

I have a Products table and Downloads table. The Downloads table has 4 fields,

  • 0

I have a Products table and Downloads table.

The Downloads table has 4 fields, ID, Name, Category and Download

The Products table has 3 fields specific to Downloads: Downloads, Order Guides and Submittal Sheets. Each one of these fields stores the ID of the record from the Downloads table. There will never be the same Download ID value for these 3 fields in the Product table.

I have the follow SQL statement:

SELECT product_id, product_name, product_download, product_submittal, product_ordering_guide, product_status, tbl_downloads.download_id, tbl_downloads.download_name
FROM tbl_products
LEFT JOIN tbl_downloads ON tbl_products.product_download=tbl_downloads.download_id
LEFT JOIN tbl_downloads ON tbl_products.product_submittal=tbl_downloads.download_id
LEFT JOIN tbl_downloads ON tbl_products.product_order_guide=tbl_downloads.download_id

It generates the following error:

#1066 - Not unique table/alias: 'tbl_downloads'

This error makes sense and I know it was going to happen, but I don’t know how to fix it. I need to add an Alias, but not sure where.

If I remove the last two JOIN statements, everything works as expected.

Thanks

  • 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-17T16:06:49+00:00Added an answer on June 17, 2026 at 4:06 pm

    You need to use unique aliases if you are joining the same table multiple times:

    SELECT product_id, product_name, 
        product_download, product_submittal, 
        product_ordering_guide, product_status, 
        d1.download_id DownloadId, 
        d1.download_name DownloadName,
        d2.download_id SubmittalDownloadId, 
        d2.download_name SubmittalDownloadName,
        d3.download_id GuideDownloadId, 
        d3.download_name GuideDownloadName
    FROM tbl_products
    LEFT JOIN tbl_downloads d1
        ON tbl_products.product_download=d1.download_id
    LEFT JOIN tbl_downloads d2
        ON tbl_products.product_submittal=d2.download_id
    LEFT JOIN tbl_downloads d3
        ON tbl_products.product_order_guide=d3.download_id
    

    For example I used d1, d2 and d3 but you might want to be more descriptive in your aliases so it is clear what each join is doing, like this:

    SELECT product_id, product_name, 
        product_download, product_submittal, 
        product_ordering_guide, product_status, 
        download.download_id DownloadId, 
        download.download_name DownloadName,
        submittal.download_id SubmittalDownloadId, 
        submittal.download_name SubmittalDownloadName,
        guide.download_id GuideDownloadId, 
        guide.download_name GuideDownloadName
    FROM tbl_products
    LEFT JOIN tbl_downloads download
        ON tbl_products.product_download=download.download_id
    LEFT JOIN tbl_downloads submittal
        ON tbl_products.product_submittal=submittal.download_id
    LEFT JOIN tbl_downloads guide
        ON tbl_products.product_order_guide=guide.download_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a products table, with the fields productname, category and cost, of type
I have a products table which contains information about products. Each products can have
For an e-shop I have Products table (id, name, price, description) Attributes table (attribute
I have a PRODUCTS table, and each product can have multiple attributes so I
I have a products table with a column for price and master category. I'd
Hello I have a products table having fields products_id,products_number,products_status,products_price where products_id is auto_increment and
I have a products table, and a pictures table as such: Products id name
I have the following structure: Table: products id, name, sort_order Let's say I only
I have a products table that contains a FK for a category, the Categories
I have a products table containing products. Each product can have multiple images. 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.