Reply to Re: Short query question (Where clause ..)

Your name:

Reply:


Posted by Carl on 11/15/24 11:22

frizzle wrote:
> Hi there,
> I can not seem to figure out where
> to put my WHERE clause in the next query:
>
> SELECT s.id,
> s.kind_id,
> s.active,
> s.name,
> COUNT(p.id) AS 'quantity'
> FROM pr_series s
> LEFT JOIN pr_products p
> ON p.series_id=s.id
> GROUP BY s.id, s.name
> WHERE s.kind_id = '1'
> ORDER BY s.name ASC
> LIMIT 0, 20
>
> This gives me a mysql error, and i can't find out where to put "WHERE
> s.kind_id = '1'". I'm new to the LEFT JOIN & GROUP BY things, i've read
> about it but, as i said, can't get it to work ... :(
> Are the WHERE and JOIN / GROUP BY parts not meant to be in 1 query?
>
> Any help would be greatly appreciated ...
>
> Greetings Frizzle.
>

Examples are shown all throughout the mysql manual if thats what you are
using. Try looking at the JOIN SYTAX page for more details (
http://dev.mysql.com/doc/mysql/en/join.html ).

Carl.

P.S. The WHERE should be before the GROUP BY clause.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация