Hi,
The query below works perfectly on MySQL - 4.0.16-nt but on MySQL - 4.1.19-standard, I get the following error :
Does anyone has an explanation?
Thanks!
The query below works perfectly on MySQL - 4.0.16-nt but on MySQL - 4.1.19-standard, I get the following error :
#1109 - Unknown table 't7' in order clause
Does anyone has an explanation?
Thanks!
Code:
SELECT t7. * , CONCAT( t1.cat_ID, '.', t2.cat_ID, '.', t3.cat_ID, '.', t4.cat_ID, '.', t5.cat_ID, '.', t6.cat_ID, '.', t7.cat_ID ) AS cat_parent_IDs
FROM mod_ecom_prod_cats AS t1
INNER JOIN mod_ecom_prod_cats AS t2 ON t2.cat_parent_ID = t1.cat_ID
INNER JOIN mod_ecom_prod_cats AS t3 ON t3.cat_parent_ID = t2.cat_ID
INNER JOIN mod_ecom_prod_cats AS t4 ON t4.cat_parent_ID = t3.cat_ID
INNER JOIN mod_ecom_prod_cats AS t5 ON t5.cat_parent_ID = t4.cat_ID
INNER JOIN mod_ecom_prod_cats AS t6 ON t6.cat_parent_ID = t5.cat_ID
INNER JOIN mod_ecom_prod_cats AS t7 ON t7.cat_parent_ID = t6.cat_ID
AND (
t1.cat_ID = "0"
)
WHERE t1.cat_parent_ID = "0"
UNION ALL SELECT t6. * , CONCAT( t1.cat_ID, '.', t2.cat_ID, '.', t3.cat_ID, '.', t4.cat_ID, '.', t5.cat_ID, '.', t6.cat_ID ) AS cat_parent_IDs
FROM mod_ecom_prod_cats AS t1
INNER JOIN mod_ecom_prod_cats AS t2 ON t2.cat_parent_ID = t1.cat_ID
INNER JOIN mod_ecom_prod_cats AS t3 ON t3.cat_parent_ID = t2.cat_ID
INNER JOIN mod_ecom_prod_cats AS t4 ON t4.cat_parent_ID = t3.cat_ID
INNER JOIN mod_ecom_prod_cats AS t5 ON t5.cat_parent_ID = t4.cat_ID
INNER JOIN mod_ecom_prod_cats AS t6 ON t6.cat_parent_ID = t5.cat_ID
AND (
t1.cat_ID = "0"
)
WHERE t1.cat_parent_ID = "0"
UNION ALL SELECT t5. * , CONCAT( t1.cat_ID, '.', t2.cat_ID, '.', t3.cat_ID, '.', t4.cat_ID, '.', t5.cat_ID ) AS cat_parent_IDs
FROM mod_ecom_prod_cats AS t1
INNER JOIN mod_ecom_prod_cats AS t2 ON t2.cat_parent_ID = t1.cat_ID
INNER JOIN mod_ecom_prod_cats AS t3 ON t3.cat_parent_ID = t2.cat_ID
INNER JOIN mod_ecom_prod_cats AS t4 ON t4.cat_parent_ID = t3.cat_ID
INNER JOIN mod_ecom_prod_cats AS t5 ON t5.cat_parent_ID = t4.cat_ID
AND (
t1.cat_ID = "0"
)
WHERE t1.cat_parent_ID = "0"
UNION ALL SELECT t4. * , CONCAT( t1.cat_ID, '.', t2.cat_ID, '.', t3.cat_ID, '.', t4.cat_ID ) AS cat_parent_IDs
FROM mod_ecom_prod_cats AS t1
INNER JOIN mod_ecom_prod_cats AS t2 ON t2.cat_parent_ID = t1.cat_ID
INNER JOIN mod_ecom_prod_cats AS t3 ON t3.cat_parent_ID = t2.cat_ID
INNER JOIN mod_ecom_prod_cats AS t4 ON t4.cat_parent_ID = t3.cat_ID
AND (
t1.cat_ID = "0"
)
WHERE t1.cat_parent_ID = "0"
UNION ALL SELECT t3. * , CONCAT( t1.cat_ID, '.', t2.cat_ID, '.', t3.cat_ID ) AS cat_parent_IDs
FROM mod_ecom_prod_cats AS t1
INNER JOIN mod_ecom_prod_cats AS t2 ON t2.cat_parent_ID = t1.cat_ID
INNER JOIN mod_ecom_prod_cats AS t3 ON t3.cat_parent_ID = t2.cat_ID
AND (
t1.cat_ID = "0"
)
WHERE t1.cat_parent_ID = "0"
UNION ALL SELECT t2. * , CONCAT( t1.cat_ID, '.', t2.cat_ID ) AS cat_parent_IDs
FROM mod_ecom_prod_cats AS t1
INNER JOIN mod_ecom_prod_cats AS t2 ON t2.cat_parent_ID = t1.cat_ID
AND (
t1.cat_ID = "0"
)
WHERE t1.cat_parent_ID = "0"
UNION ALL SELECT t1. * , t1.cat_ID AS test
FROM mod_ecom_prod_cats AS t1
WHERE t1.cat_parent_ID = "0"
ORDER BY t7.cat_parent_ID, cat_ID
LIMIT 0 , 100