Many thanks for your reply Shawn - I have some comments below.
Hello,
I need to be able to sum over distinct values but I can't seem to do it
unless I use sub-selects (which I want to avoid doing).
To see what I mean, I've constructed a toy DB:
DROP TABLE IF EXISTS spell;
CREATE TABLE
Hello,
I need to be able to sum over distinct values but I can't seem to do it
unless I use sub-selects (which I want to avoid doing).
To see what I mean, I've constructed a toy DB:
DROP TABLE IF EXISTS spell;
CREATE TABLE spell (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
power
have never searched hard for the
ability. It seems unlikely - since you get to name the columns in the table
and the columns in the query (using 'as'). I suggest you use one of those
abilities.
-Original Message-
From: Yasir Assam [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 08, 2006
on the temp table and then of course dropping
it.
-Original Message-
From: Yasir Assam [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 08, 2006 7:10 PM
To: mysql@lists.mysql.com
Subject: Aggregate functions in ORDER BY
Hello,
I noticed something strange in MySQL (I'm using 4.1.15).
If I use
Hello,
I noticed something strange in MySQL (I'm using 4.1.15).
If I use an aggregate function in the ORDER BY clause I get an error.
SELECT men.man_name,
COUNT(pets.pet_id)
FROM men,
pets
WHERE men.man_id = pets.pet_man_id
GROUP BY men.man_id
ORDER BY COUNT(pets.pet_id) DESC;
gives
by count
) as subtable
Dave
-Original Message-
From: Yasir Assam [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 08, 2006 9:10 PM
To: mysql@lists.mysql.com
Subject: Aggregate functions in ORDER BY
Hello,
I noticed something strange in MySQL (I'm using 4.1.15).
If I use an aggregate
Is there a simple way of checking whether all the columns in a SELECT
are NULL? I know I can do the following:
SELECT c1, c2, c3 FROM t WHERE COALESCE(c1, c2, c3) IS NOT NULL
but this relies on specifying every column I've selected (which in my
actual code is a lot of columns that may change