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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:22:56+00:00 2026-05-16T22:22:56+00:00

I’m trying to use a join on three tables query I found in another

  • 0

I’m trying to use a join on three tables query I found in another post (post #5 here). When I try to use this in the SQL tab of one of my tables in phpMyAdmin, it gives me an error:

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

The exact query I’m trying to use is:

select r.*,m.SkuAbbr, v.VoucherNbr from arrc_RedeemActivity r, arrc_Merchant m, arrc_Voucher v
LEFT OUTER JOIN arrc_Merchant m ON (r.MerchantID = m.MerchantID)
LEFT OUTER JOIN arrc_Voucher v ON (r.VoucherID = v.VoucherID)

I’m not entirely certain it will do what I need it to do or that I’m using the right kind of join (my grasp of SQL is pretty limited at this point), but I was hoping to at least see what it produced.

(What I’m trying to do, if anyone cares to assist, is get all columns from arrc_RedeemActivity, plus SkuAbbr from arrc_Merchant where the merchant IDs match in those two tables, plus VoucherNbr from arrc_Voucher where VoucherIDs match in those two tables.)

Edited to add table samples

Table arrc_RedeemActivity
RedeemID | VoucherID | MerchantID | RedeemAmt
----------------------------------------------
1        | 2         |  3         | 25
2        | 6         |  5         | 50

Table arrc_Merchant
MerchantID | SkuAbbr
---------------------
3         | abc         
5         | def         

Table arrc_Voucher
VoucherID | VoucherNbr
-----------------------
2         | 12345       
6         | 23456

So ideally, what I’d like to get back would be:

RedeemID | VoucherID | MerchantID | RedeemAmt | SkuAbbr | VoucherNbr
-----------------------------------------------------------------------
1        | 2         | 3          | 25        | abc     | 12345
2        | 2         | 5          | 50        | def     | 23456
  • 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-16T22:22:56+00:00Added an answer on May 16, 2026 at 10:22 pm

    The problem was you had duplicate table references – which would work, except for that this included table aliasing.

    If you want to only see rows where there are supporting records in both tables, use:

    SELECT r.*,
           m.SkuAbbr, 
           v.VoucherNbr 
      FROM arrc_RedeemActivity r
      JOIN arrc_Merchant m ON m.merchantid = r.merchantid
      JOIN arrc_Voucher v ON v.voucherid = r.voucherid
    

    This will show NULL for the m and v references that don’t have a match based on the JOIN criteria:

       SELECT r.*,
              m.SkuAbbr, 
              v.VoucherNbr 
         FROM arrc_RedeemActivity r
    LEFT JOIN arrc_Merchant m ON m.merchantid = r.merchantid
    LEFT JOIN arrc_Voucher v ON v.voucherid = r.voucherid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.