group by errors

From: chris (anonymous.chris_at_mercury-projects.co.nz.discussions.microsoft.com)
Date: 04/27/04


Date: Mon, 26 Apr 2004 18:11:25 -0700

My guess would be that you are trying to use SQL syntax in
Access which supports a different dialect. Try either
Using a passthrough query in Access or
Creating a view in SQL and use Access to open the view

>-----Original Message-----
>Hello all,
>
>I'm using Access 2k as a front end to a SQL server. I'm
trying to
>create some queries to aggregate some data. Looking at
the help files,
>I see group all by ... with cube | rollup as being valid.
>
>I get syntax errors if I try group all by, group by with
cube, or
>group by with rollup. Does anyone know what is going on?
Is the help
>file incorrect?
>
>
>Syntax
>[ GROUP BY [ALL] group_by_expression [,.n]
> [ WITH { CUBE | ROLLUP } ]
>]
>
>Arguments
>ALL
>Includes all groups and result sets, even those that do
not have any
>rows that meet the search condition specified in the
WHERE clause.
>When ALL is specified, null values are returned for the
summary
>columns of groups that do not meet the search condition.
You cannot
>specify ALL with the CUBE or ROLLUP operators.
>GROUP BY ALL is not supported in queries that access
remote tables.
>
>group_by_expression
>Is an expression on which grouping is performed.
group_by_expression
>is also known as a grouping column. group_by expression
can be a
>column or a nonaggregate expression that references a
column. A column
>alias that is defined in the select list cannot be used
to specify a
>grouping column. When GROUP BY is specified, any column
in the select
>list (except a column used in an aggregate function) must
be specified
>as a grouping column.
>----------------------------------------------------------
----------------------
>
>Note Columns of type text, ntext, image, and bit cannot
be used in
>group_by_expression.
>
>
>----------------------------------------------------------
----------------------
>
>For GROUP BY clauses that do not contain CUBE or ROLLUP,
the number of
>group_by_expression items is limited by the GROUP BY
column sizes, the
>aggregated columns, and the aggregate values involved in
the query.
>This limit originates from the limit of 8,060 bytes on the
>intermediate work table that is needed to hold
intermediate query
>results. A maximum of 10 grouping expressions is
permitted when CUBE
>or ROLLUP is specified.
>
>CUBE
>Specifies that, in addition to the usual rows provided by
GROUP BY,
>summary rows are introduced into the result set. A GROUP
BY summary
>row is returned for every possible combination of group
and subgroup
>in the result set. A GROUP BY summary row is displayed as
NULL in the
>result, but is used to indicate all values. Use the
GROUPING function
>to determine whether null values in the result set are
GROUP BY
>summary values.
>The number of summary rows in the result set is
determined by the
>number of columns included in the GROUP BY clause. Each
operand
>(column) in the GROUP BY clause is bound under the
grouping NULL and
>grouping is applied to all other operands (columns).
Because CUBE
>returns every possible combination of group and subgroup,
the number
>of rows is the same, regardless of the order in which the
grouping
>columns are specified.
>
>ROLLUP
>Specifies that, in addition to the usual rows provided by
GROUP BY,
>summary rows are introduced into the result set. Groups
are summarized
>in a hierarchical order, from the lowest level in the
group to the
>highest. The group hierarchy is determined by the order
in which the
>grouping columns are specified. Changing the order of the
grouping
>columns can affect the number of rows produced in the
result set.
>----------------------------------------------------------
----------------------
>
>Important Distinct aggregates, for example, AVG(DISTINCT
column_name),
>COUNT(DISTINCT column_name), and SUM(DISTINCT
column_name), are not
>supported when using CUBE or ROLLUP. If used, SQL Server
returns an
>error message and cancels the query.
>
>Thanks
>Sean
>.
>



Relevant Pages

  • Re: Dont want to wrap long text - just truncate
    ... document then postprocess the results using VBA, ... All you can do in the standard user interface is specify a table of view, ... you have to specify the SQL in an OpenDataSource method call in VBA. ... via MS Query, MS Query has to be installed, and you will need an ODBC DSN ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Dont want to wrap long text - just truncate
    ... >new document then postprocess the results using VBA, ... > and specify a bit of sorting and filtering (go into the Edit Recipients ... To do more, you either have to go through MS Query, ... > or you have to specify the SQL in an OpenDataSource method call in VBA. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: slow delete query
    ... Try pasting that sql text ... >> query and see if it will work (but back up the database ... >> query builder to design your queries you can specify ...
    (microsoft.public.access.queries)
  • Re: Data Access Components
    ... SQL Server 2005 allows you to specify Query Hints without actually modifying ... Including Dynamic SQL/Embedded SQL. ...
    (microsoft.public.dotnet.framework.adonet)
  • MS Access/VBA Question - Using Multiple combo Boxes to Search on a Form
    ... -I have a form with several combo boxes and several text ... a button is clicked which launches a new form (frmResults). ... frmResults is bound to a query, the criteria of which is set to the ... specify anything for a particular field. ...
    (microsoft.public.office.developer.vba)