Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

MySQL Query


Mr_Cheese's Avatar
0 1
 SELECT count( p.products_id ) AS total
FROM products_description AS pd, products AS p
LEFT JOIN manufacturers AS m ON p.manufacturers_id = m.manufacturers_id, products_to_categories p2c
LEFT JOIN specials AS s ON p.products_id = s.products_id
WHERE p.products_status = '1'
AND p.products_id = p2c.products_id
AND pd.products_id = p2c.products_id
AND pd.language_id = '1'
AND p2c.categories_id = '176' 

markup#1054 - Unknown column 'p.products_id' in 'on clause'

Its mySQL v5. I have this exact same setup on a live up and running website and it works fine. however i'm setting up a development environment on a new server, and i've had to upgrade from MySQL 4 to MySQL 5.. and now i get this error.

the table products deffinatly exsists.. products_id deffinatly exsists. yet i get this error.. im sure my JOIN's are fine.

suggestions?


spyware's Avatar
Banned
0 0

-stupid comment-

EDIT:

Try inputting your SQL syntax directly into the input box rather than using PHP. See what happens.


Mr_Cheese's Avatar
0 1

p.products_id deffinatley exsists.

all the tables and colums are deffiantly there, becuse im using the exact same setup on another server using mySQL v4.

i figure its a v4 / v5 issue, because we all know v5 is alot more sensitive.

i just cant figure out which bit if wrong… :whoa:

and yes, i thought maybe it was a connection issue, so now im using phpmyadmin and it still gives same error.


ghost's Avatar
0 0

LEFT JOIN manufacturers AS m ON p.manufacturers_id = m.manufacturers_id, products_to_categories** p2c** propably you forgot a comma(,) or as Q?


Mr_Cheese's Avatar
0 1

Thanks for the replies, i've now fixed it.

solution:


SELECT count( p.products_id ) AS total
FROM (products_description AS pd, products AS p, products_to_categories p2c)
LEFT JOIN manufacturers AS m ON p.manufacturers_id = m.manufacturers_id
LEFT JOIN specials AS s ON p.products_id = s.products_id
WHERE p.products_status = '1'
AND p.products_id = p2c.products_id
AND pd.products_id = p2c.products_id
AND pd.language_id = '1'
AND p2c.categories_id = '176' 

dam MySQL v5!