Jump to content

Recommended Posts

i was wondering... it seems an alias from an outer Query being used in an inner one doesnt work in MYSQL5.

 

heres a quick example:

SELECT *

FROM db.test1 t1

JOIN

(

SELECT t2.

FROM db.test2 t2

WHERE t2.age=t1.age

) as xxx ON t1.ID=xxx.ID

 

MYSQL will say something like unknown column 't1.age' in where clause since i think u cant have table aliases in WHERE clauses, so how do you target that field? i think my orig query had 2 outer joins, so there would be 2 age fields to use in the inner query, so i needed to somehow target it and an alias doesnt work. any ideas?

Link to comment
https://forums.phpfreaks.com/topic/45739-mysql-subquery-aliases/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.