[NBLUG/talk] OT - SQL query question

Garland, David david.garland at medtronic.com
Fri Dec 2 11:24:36 PST 2005


If you don't have multiple values in other fields per unique addr1, then
you can just do a distinct on everything.  With only 12000 records, it's
not like you're going to see a performance hit.

However, if you do have multiple values in other fields per unique
addr1, you would have to aggregate and min/max the other values:

Example:

Select addr1, min(fld2), min(fld3), min(fld4), etc
>From tablename
Group by addr1

I don't know if dBase supports ANSI.  If so, you would have a few other
options.

David

-----Original Message-----
From: talk-bounces at nblug.org [mailto:talk-bounces at nblug.org] On Behalf
Of Mark Street
Sent: Friday, December 02, 2005 10:12 AM
To: talk at nblug.org
Subject: [NBLUG/talk] OT - SQL query question

This is slightly off topic.  I have an old dBase database with 12000
records.  
There are some records with the same address field.  I need to strip out
the DISTINCT address records into a separate database.

SELECT DISTINCT ADDR1 FROM MYDB gets me the unique addresses but I need
the other fields as well.

What would be the best way to do this?

--
Mark Street, RHCE
http://www.oswizards.com
--
Key fingerprint = 3949 39E4 6317 7C3C 023E  2B1F 6FB3 06E7 D109 56C0 GPG
key http://www.oswizards.com/pubkey.asc

_______________________________________________
talk mailing list
talk at nblug.org
http://nblug.org/cgi-bin/mailman/listinfo/talk



More information about the talk mailing list