RE: [PHP-DB] something is wrong with this query
| From: | Michael Hazelden | Date: | Sun, 18 Aug 2002 02:05:30 +0000 |
| Subject: | RE: [PHP-DB] something is wrong with this query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21200@lists.php.net to get a copy of this message | ||
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
*********************************************************************