Re: [PHP-DB] something is wrong with this query

2002-08-17 Thread JJ Harrison

Thanks

I originally wasn't doing a cross-table join with that query so I forgot to
put the join in :-}


--
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com

--
Please reply on the list/newsgroup unless the reply it OT.


"Michael Hazelden" <[EMAIL PROTECTED]> wrote in message
C1260EE72F22C44F833D033A17524AD7016A6C68@lhoexc1">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:[EMAIL PROTECTED]]
> Sent: 18 August 2002 02:45
> To: [EMAIL PROTECTED]
> 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
> [EMAIL PROTECTED]
> 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
>
> *



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] something is wrong with this query

2002-08-17 Thread Michael Hazelden

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:[EMAIL PROTECTED]]
Sent: 18 August 2002 02:45
To: [EMAIL PROTECTED]
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
[EMAIL PROTECTED]
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

*

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php