[thelist] OT: dont stiff the webmaster...
Joshua Olson
joshua at alphashop.com
Fri Oct 5 15:35:03 CDT 2001
Run away...
<tip type="SQL" author="Joshua Olson">
GROUP BY queries are nice, but remember that you cannot (read: CANNOT)
return row level detail information if you use them. You can, however,
summarize what's in each group by using an aggregate function such as Max()
or Count()
So, "SELECT Max(id) FROM users GROUP BY username" makes sense, but
"SELECT id FROM users GROUP BY username" does not.
Another example, this will not give you the details of records with matching
emails:
SELECT name, id FROM users GROUP BY email HAVING Count(*) > 1
However, this will (thanx rudy):
SELECT name, id
FROM users
WHERE email IN (SELECT email
FROM users
GROUP BY email
HAVING Count(*) > 1)
</tip>
----- Original Message -----
From: "Jon Hall" <jonhall at ozline.net>
Subject: Re: [thelist] OT: dont stiff the webmaster...
: Here is where it gets even funnier, apparently the site only cost $75 and
a
More information about the thelist
mailing list