How to use DISTINCT for two attributes combined
From: Xiaoxin Yin <xyin1_at_uiuc.edu>
Date: Sun, 27 Jul 2003 23:59:32 -0500
Message-ID: <I12Va.4195$o7.54409_at_vixen.cso.uiuc.edu>
Hi,
Date: Sun, 27 Jul 2003 23:59:32 -0500
Message-ID: <I12Va.4195$o7.54409_at_vixen.cso.uiuc.edu>
Hi,
I want to select the count of distinct tuples in a table for some query. For
example,
However, it is not recognized by sql server. Is there any way that I can get
select count(distinct A.a1, A.a2) from FirstRel A, SecondRel B where
A.a3=B.b1 group by B.b2, B.b3
(Suppose FirstRel.a1 and FirstRel.a2 is the primary key of FirstRel.)
Thanks a lot,
Xiaoxin Received on Mon Jul 28 2003 - 06:59:32 CEST