|
|
Sponsor |
Re: Using 'DISTINCT ON' clause in select statement: msg#00159lang.perl.modules.dbix-class
On 8/18/06, John Siracusa <siracusa@xxxxxxxxxxxxxx> wrote: > ...where "extension of the standard" here means "crazy thing that > makes no sense." > > CREATE TABLE t (a INT, b INT, c INT); > > INSERT INTO t VALUES (1, 2, 3); > INSERT INTO t VALUES (1, 2, 4); > INSERT INTO t VALUES (1, 2, 5); > INSERT INTO t VALUES (1, 2, 6); > > Now guess what value c will have in the row returned by this query: > > SELECT a, SUM(b), c FROM t GROUP BY a; > > Good old MySQL... Sure, the columns you select must have unique values per group. That limitation used to be stated in the MySQL docs. It may still be, but I can't find it now. Within that limitation, the extension can be handy in some circumstances, but as with any non-standard feature, you're increasing the pain you'll feel if you migrate to another DB in the future.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Using 'DISTINCT ON' clause in select statement, Stephan Szabo |
|---|---|
| Next by Date: | Re: Using 'DISTINCT ON' clause in select statement, John Siracusa |
| Previous by Thread: | Re: Using 'DISTINCT ON' clause in select statement, John Siracusa |
| Next by Thread: | Re: Using 'DISTINCT ON' clause in select statement, John Siracusa |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|