🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11339

Re: Multiple counts

#11339
From: Arno Brinkman
Date: Fri, 22 Nov 2002 12:44
21 lines
1388 bytes
Hi,

> Does anyone know how i would count the number of records via a distinct
> selection.
>
> i.e. Select distinct Agent_Name from Table1 brings me all the agents but I
> would like to do a record count for each without having to do a select
> count(*) for each one manually?

If i understand you right then use GROUP BY.

SELECT
  AGENT_NAME,
  COUNT(*)
FROM
  Table1
GROUP BY
  AGENT_NAME

Regards,
Arno Brinkman
Technical Details
Message-ID: <3dde26ed@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3dde12b2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,edf94dfb88a4c551
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-11-22 04:45:51 PST
From: "Arno Brinkman" <_firebird@abvisie.nl_>
Newsgroups: borland.public.interbase.sql
References: <3dde12b2$1@newsgroups.borland.com>
Subject: Re: Multiple counts
Date: Fri, 22 Nov 2002 13:44:44 +0100
Lines: 25
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
NNTP-Posting-Host: 213.116.162.149
Message-ID: <3dde26ed@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1037969133 213.116.162.149 (22 Nov 2002 04:45:33 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-08!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail