how this query should be in mysql 5

how this query should be in mysql 5

am 24.04.2006 10:18:37 von daniel.czestki

Hello,

I have query which work in mysql 4
In mysql 5 I have error 1054.

this is this query:
select
count(p.products_id) as total

from
products_description pd, products p
left join manufacturers m on p.manufacturers_id = m.manufacturers_id,
products_to_categories p2c left join specials 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 = '21'

-----------------------------

how change it to mysql 5 ??
thanks

Re: how this query should be in mysql 5

am 24.04.2006 21:22:34 von Bill Karwin

daniel.czestki@wp.pl wrote:
> from
> products_description pd, products p
> left join manufacturers m on p.manufacturers_id = m.manufacturers_id,
> products_to_categories p2c left join specials s on p.products_id =
> s.products_id

> how change it to mysql 5 ??

They changed the rules of order of evaluation in FROM clauses in MySQL5,
to bring the semantics closer to the ANSI standard SQL.

You can solve this by using parentheses, or you can use SQL-92 JOIN
syntax throughout. For example:

FROM
products p
JOIN products_to_categories p2c ON p.products_id = p2c.product_id
JOIN products_description pd ON p2c.products_id = pd.products_id
LEFT JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id
LEFT JOIN specials s ON p.products_id = s.products_id

Regards,
Bill K.