At 1:46 AM +0100 9/14/01, Jamie Burns wrote:
>Hello,
>
>I have a query as follows:
>
> SELECT products.*, avg(ratings.rating) AS rating
> FROM products, ratings
> WHERE products.ref = ratings.product_ref
> GROUP BY products.ref
> ORDER BY rating
>
>In one sense this query works fine - it
Hi.
Just use a LEFT JOIN and you will get a "default of NULL" whenever
there is no entry in the rating table for a product_ref.
Bye,
Benjamin.
On Fri, Sep 14, 2001 at 01:46:01AM +0100, [EMAIL PROTECTED] wrote:
> Hello,
>
> I have a query as follows:
>
> SELECT products.*, avg(ratin
Hello,
I have a query as follows:
SELECT products.*, avg(ratings.rating) AS rating
FROM products, ratings
WHERE products.ref = ratings.product_ref
GROUP BY products.ref
ORDER BY rating
In one sense this query works fine - it adds a new column called 'rating'
(which is a dynamically ca