🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #863

SQL & GROUP BY / Adding Record Numbers ...

#863
From: Vladimir Stefanovic
Date: Fri, 01 Jul 2005 15:22
33 lines
1433 bytes
Hi,

I need help with SQL statement. If I have a basic
grouping statement like this:

   SELECT Field, COUNT(Field)
   FROM SomeTbl
   WHERE OtherField ='Something'
   GROUP BY Field
   ORDER BY Field

I'll get something like this:

   AAA      5
   BBB       3
   CCC      1
   DDD      6
   EEEE     3

But How can I assing the record numbers?

   1   AAA      5
   2   BBB       3
   3   CCC      1
   4   DDD      6
   5   EEEE     3




-- 
Best regards,
Vladimir Stefanovic 
Technical Details
Message-ID: <42c55fd0@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,792d6094ea51af2f,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Vladimir Stefanovic" <antivari@po.sbb.co.yu>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: SQL & GROUP BY / Adding Record Numbers ...
Date: Fri, 1 Jul 2005 17:22:50 +0200
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 82.117.212.65
Message-ID: <42c55fd0@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1120231376 82.117.212.65 (1 Jul 2005 08:22:56 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail