I have the following query :
(select xyz.* from
(select xt.image, p.*, pc.categoryid, c.category,
(select value from xcart_extra_field_values
where efv.productid=p.productid and efv.fieldid = 2) as Type,
(select value from xcart_extra_field_values
where efv.productid=p.productid and efv.fieldid = 1) as Zone
FROM xcart_products p
inner join xcart_products_categories pc
on p.productid=pc.productid
inner join xcart_categories c
on pc.categoryid=c.categoryid
inner join xcart_extra_field_values efv
on p.productid=efv.productid
inner join xcart_images_T xt
on p.productid=xt.id) xyz
where categoryid='1' and Type='2' and Zone='1'
group by productid)
But when I execute this query in phpmyadmin it displays a error messgae :
#1242 - Subquery returns more than 1 row
Whats wrong in the query.Please help. Thanks in advance.
I think (part of) the problem is that you are re-using an alias in a wrong location.
You should one use an alias once, and don’t mix them for different instances of the same table.
So use a unique alias efvx for each
xcart_extra_field_valuestable instance.