Board index » delphi » Group by syntax

Group by syntax

 Greetings folks,

  we are trying to write a simple statement

  Select
     Cast(column1 as varchar(32)) Name, count(column2)
  from
    sometable
  group by  Name

Gives the column unkown error , so does group by 1

I know other RDBMS allow grouping of aliased columns, any comments would be
appreciated.

DW

 

Re:Group by syntax


Try: group by 1

--
Sergio Samayoa
Lgica Software
http://www.geocities.com/logicasw/

Re:Group by syntax


uknown Column 1 ????????
Quote
In article <3bbb1951_2@dnews>, "Sergio Samayoa" <serg...@terra.com.gt> wrote:
>Try: group by 1

Re:Group by syntax


Quote
Dave Williams wrote:

> I know other RDBMS allow grouping of aliased columns, any comments would be
> appreciated.

        Put the SELECT in a VIEW, and group the fields in the VIEW.

        -Craig

--
 Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
     Delphi/InterBase WebLog: http://delphi.weblogs.com

Re:Group by syntax


Quote
>   we are trying to write a simple statement

>   Select
>      Cast(column1 as varchar(32)) Name, count(column2)
>   from
>     sometable
>   group by  Name

What is the purpose of the CAST in your statement ?

Ivan

Other Threads