|
-----Message d'origine-----
De : midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] De la part de Charles Wilt
Envoyé : jeudi 2 septembre 2010 14:51
À : Midrange Systems Technical Discussion
Objet : Re: SQL for a statistic result set
Ah, SQL with my coffee...
WITH ProductCounts as (SELECT client,
count(distinct product) as productCount
FROM qtemp/david
GROUP BY client
)
SELECT productCount, count(*) as clientCount FROM
ProductCounts group by productCount
HTH,
Charles
On Thu, Sep 2, 2010 at 8:32 AM, David FOXWELL
<David.FOXWELL@xxxxxxxxx> wrote:
Hi all,average a client has 2 products, that no client has more than
I have a table like so :
Client Product
C1 P1
C1 P2
C2 P1
C3 P4
C4 P1
C4 P2
C4 P3
With the max, min and avg functions I can see that on
7 products and none with less than 1.
(MIDRANGE-L) mailing
But how can I output :
Number of products Number of clients
1 ?
2
3
4
5
6
7
Thanks.
--
This is the Midrange Systems Technical Discussion
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,please take
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting,
a moment to review the archives at--
http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion
(MIDRANGE-L) mailing list To post a message email:
MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change
list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting,
please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.