Forum Moderators: open
MySQL version 5.0.67
Example
Sub Select Works:
select
product.name,
(select src from images
where images.product_id = product.product_id
order by sort_order desc limit 1)
from product
Sub Select with inner join referencing main table Does not work in MYSQL (but does work in MSSQL!)
select
product.name,
(select lvl from listing
inner join listing_rel on listing_rel.product_id = product.product_id)
)
from product
The error in MYSQL:
#1054 - Unknown column 'product.product_id' in 'on clause'
Please note: this same query works fine in MSSQL
Anyone else come across this?
select
product.name,
(select lvl from listing
inner join listing_rel on listing_rel.product_id = product.product_id)
)
from product
What exactly do you WANT the query to do - that should be the key to rewriting it into a form mysql can understand.
p.s.
What kind of tables are you using (myisam or innodb)?
Maybe try this
select
product.name,
(select lvl from listing
inner join listing_rel on listing_rel.product_id = listing.product_id where listing_rel.product_id = product.product_id)
)
from product
We are using myisam tables because the mysql copy is a readonly version of the mssql database.