|
Log in | ||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
I run this, to get a count of items by year, I get an error saying the
EXTRACT in line 3 is an invalid SQL name. SELECT EXTRACT(YEAR FROM dt), count(*) FROM "transactions" GROUP BY EXTRACT(YEAR FROM dt) "dt" is a Date column. Isn't this supposed to work? Regards. |
|
#2
|
|||
|
|||
|
> SELECT EXTRACT(YEAR FROM dt), count(*)
> FROM "transactions" > GROUP BY EXTRACT(YEAR FROM dt) It will likely work if you add an alias to the select expression, and group by the alias. Wether or not the above should work I leave to more SQL savvy people. ![]() -- Eivind Bakkestuen [NDD] Please, no email unless requested. Search Borland and third-party newsgroups here: www.tamaracka.com |
|
#3
|
|||
|
|||
|
On Thu, 1 Jul 2004 00:00:07 +1000, "Eivind Bakkestuen [NDD]"
<Ieivind.bakkestuenHATE@nexusdb.comSPAM> wrote: >> SELECT EXTRACT(YEAR FROM dt), count(*) >> FROM "transactions" >> GROUP BY EXTRACT(YEAR FROM dt) > >It will likely work if you add an alias to the select expression, and group >by the alias. Wether or not the above should work I leave to more SQL savvy >people. ![]() It does, thanks: SELECT EXTRACT(YEAR FROM "dt") "Date", count(*) FROM "transactions" GROUP BY "Date" However, the <ahem> manual implies that an alias is not needed (see G.6.4.13 EXTRACT example). Please to tell the documentation scrivner that the number of errors and omissions in the manual is now > 0. Regards. |
|
#4
|
|||
|
|||
|
<< Wether or not the above should work I leave to more SQL savvy people.
![]() >> Standard SQL requires that grouping columns reference a column by its name, i.e. the column alias if specified or the real column name if an alias is not specified. NexusDB allows grouping columns to be specified by the column name or alias interchangeably. Ole Willy Tuv |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Error: Error: NexusDB: <unnamed TnxQuery instance>: Query execution failed | Warren | nexusdb.public.support.adoprovider | 1 | 8th April 2010 02:55 PM |
| Error SQL for Insert with Group with Non-aggregate column (constant) | hhlee | nexusdb.public.support.sql | 11 | 21st November 2003 10:53 PM |
| Question on Extract/subquery | Don Miller | nexusdb.public.support.sql | 20 | 11th October 2003 08:26 PM |
| NX1.01: Cast with Group By Error | Joao Borges | nexusdb.public.support.sql | 3 | 10th October 2003 05:19 AM |
| NX1 - 'Select' Extract incorrect record when it work with Chinese | Forest Greenland | nexusdb.public.support.sql | 0 | 29th September 2003 10:33 PM |