Subject Re: [ib-support] DISTINCT
Author Doug Chamberlin
At 8/23/2001 01:59 PM (Thursday), Mike Grover wrote:
>I have been trying to use a query statement like this:
>
>"SELECT DISTINT * FROM EXPERIAN WHERE ZIP='66846' AND ZIP4='1160'"
>
>But Get all matching records, not just the first one.

The DISTINCT applies to all the fields you are selecting. Since you are
selecting *, then all fields in each record must comprise a distinct
combined value. Since every record is different (in some field) you get
them all listed.

SELECT DISTINCT ZIP, ZIP4 WHERE ZIP='66846' AND ZIP4='1160'

would yield one record with the values 66846, 1160.

Ain't SQL fun!