Re: something is wrong with this query
| From: | JJ Harrison | Date: | Sun, 18 Aug 2002 04:43:33 +0000 |
| Subject: | Re: something is wrong with this query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21203@lists.php.net to get a copy of this message | ||
Thanks
I originally wasn't doing a cross-table join with that query so I forgot to
put the join in :-}
--
JJ Harrison
webmaster@tececo.com
www.tececo.com
--
Please reply on the list/newsgroup unless the reply it OT.
"Michael Hazelden" <michael.hazelden@ocado.com> wrote in message
news:C1260EE72F22C44F833D033A17524AD7016A6C68@lhoexc1...
> Hi there - it's quite simple.
>
> In this query - you're asking for the average of the vote over the entire
> article_comment table - you haven't placed a join between the two tables.
>
> You need to find your linking field - and join them on that.
>
> Cheers,
>
> Michael.
>
> -----Original Message-----
> From: JJ Harrison [mailto:webmaster@tececo.com]
> Sent: 18 August 2002 02:45
> To: php-db@lists.php.net
> Subject: [PHP-DB] something is wrong with this query
>
>
> Here the query is:
>
> select avg(article_comment.vote) as avg, article_data.aid,
> article_data.time, article_data.name, article_data.description from
> article_data, article_comment where released > 1 GROUP BY article_data.aid
> order by time
>
> It works fine but the average echoed is always the same (which it shouldnt
> be).
>
>
> --
> JJ Harrison
> webmaster@tececo.com
> www.tececo.com
>
> --
> Please reply on the list/newsgroup unless the reply it OT.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> _____________________________________________________________________
> This message has been checked for all known viruses by the
> MessageLabs Virus Control Centre.
>
> This message has been checked for all known viruses by the MessageLabs
Virus Control Centre.
>
>
> *********************************************************************
>
> Notice: This email is confidential and may contain copyright material of
Ocado Limited (the "Company"). Opinions and views expressed in this message
may not necessarily reflect the opinions and views of the Company.
> If you are not the intended recipient, please notify us immediately and
delete all copies of this message. Please note that it is your
responsibility to scan this message for viruses.
>
> Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY
>
> *********************************************************************