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 limitations: it's not actually counting distinct values of the column
pair a,b, but only of their textual concatenation.  For example a = 'xy'
and b = 'z' will look the same as a = 'x' and b = 'yz'.

If there is some character you never use in column A, say '|', you
could do count(distinct(a || '|' || b)) with some safety, but this
strikes me as still a pretty fragile approach.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to