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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:19:08+00:00 2026-05-26T03:19:08+00:00

I’m working on a very limited MySQL environment (all MySQL calls are passed as

  • 0

I’m working on a very limited MySQL environment (all MySQL calls are passed as array parameters). The problem is I don’t know how to resolve an ambiguos condition.

In this environment all MySQL calls take this form:

SELECT value1,value2,...,valueN 
FROM table1,table2,...,tableN 
WHERE cond1 OP cond2 OP ... OP condN 

That’s not a problem until you have the same column names in table1 and table2. Imagine table1 has columns {a,b,z} and table2 has column names {c,d,f,z}. I can do this:

SELECT * 
FROM table1, table2 
WHERE a='3' AND table1.z='5'

Perfect but, one of the limitations is that I can’t use table1.z format, just z=’5′ that produces a collision.

So, the question is: is there any way to prevent this ambiguosity without the use of table name prefix in the condition part? (for example, it will be great if there is a way to use only part of table2 or say that table1 has priority in case of ambiguity).

  • 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-26T03:19:08+00:00Added an answer on May 26, 2026 at 3:19 am

    There is no way to avoid a collision if you can’t qualify which table “myColumn” comes from.

    Your constraints seem kind of silly… You’re basically asking for valid result when you assert that you cannot write valid SQL….

    Perhaps instead of SELECTing from table1, you would SELECT from a nested subquery in which you aliased the column names…

    For example:

    if table1 and table2 both have column “myColumn”
    Rather than:

     SELECT 
        * 
     FROM 
        table1,table2 
     WHERE myColumn = @value -- produces collision!
    

    Could you say:

    SELECT 
        * 
    FROM 
        (SELECT myColumn AS foo FROM table1) newTable1, 
        (SELECT myColumn AS bar FROM table2) newTable2
    WHERE 
        foo = @value
    

    This way you’re not fully qualifying the tables in the outer WHERE clause but you are re-aliasing the columns inside the subqueries (thus making them into different names for the outer query)

    This seems like a roundabout exercise though

    EDIT:
    http://thedailywtf.com/Articles/SQL-Sentences.aspx

    “MySQL sentences?”

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

Sidebar

Related Questions

I've tracked down a weird MySQL problem to the two different ways I was
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am confused How to use looping for Json response Array in another Array.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from
I know there's a lot of other questions out there that deal with this
I don't have much knowledge about the IPv6 protocol, so sorry if the question

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.