Re: [SQL] counting distinct rows on more than one column

2001-03-28 Thread Tom Lane
Dirk Lutzebaeck <[EMAIL PROTECTED]> writes: > Michael Fork writes: >>> In 7.0.3, I believe the following would work: >>> >>> SELECT count(distinct(a || b)) FROM t; > Great, this works! I don't quite get it why... Michael really should not have proposed that solution without mentioning its limit

Re: [SQL] counting distinct rows on more than one column

2001-03-28 Thread Dirk Lutzebaeck
Michael Fork writes: > In 7.0.3, I believe the following would work: > > SELECT count(distinct(a || b)) FROM t; Great, this works! I don't quite get it why... Dirk ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send

Re: [SQL] counting distinct rows on more than one column

2001-03-28 Thread Tom Lane
Dirk Lutzebaeck <[EMAIL PROTECTED]> writes: > on 7.0.3 want to COUNT > SELECT DISTINCT a,b FROM t; In 7.1 you could do select count(*) from (select distinct a,b from t) as t1; In 7.0 and before I think you have no choice but to use a temp table. regards, tom l

Re: [SQL] counting distinct rows on more than one column

2001-03-28 Thread Michael Fork
In 7.0.3, I believe the following would work: SELECT count(distinct(a || b)) FROM t; if subselects in from were supported in 7.0.3 as they are in 7.1, you could do: SELECT count(*) FROM (SELECT DISTINCT a,b FROM t) FROM x Michael Fork - CCNA - MCP - A+ Network Support - Toledo Internet Access

RE: [SQL] counting distinct rows on more than one column

2001-03-28 Thread Michael Ansley
Title: RE: [SQL] counting distinct rows on more than one column SELECT count(*) FROM (SELECT DISTINCT a, b FROM t) AS t2; should give you what you want. MikeA >> -Original Message- >> From: Dirk Lutzebaeck [mailto:[EMAIL PROTECTED]] >> Sent: 28 March 2001 1

[SQL] counting distinct rows on more than one column

2001-03-28 Thread Dirk Lutzebaeck
Hi, on 7.0.3 want to COUNT SELECT DISTINCT a,b FROM t; I can't find a solution because any combination with count with more than one column gives syntax errors. One solution would be to set a view: CREATE VIEW v AS SELECT DISTINCT a,b FROM t; and then SELECT count(a) FROM v but views do