Tony,
try this:

Step 1: 
Select ID, Min(Dist) from <table> group by ID into qMin_per_Group

Step 2:
Select <table>.ID, <table>.Dist, <table>.ID_2
  from <table>, qMin_per_Group
  where <table>.ID = qMin_per_Group.ID and <table>.Dist =
qMin_per_Group.Col2
  group by Gebiet into qResult

If you omit the Group By clause, MI will report an error, even though it
executes the query.

Good luck,
Andreas

.................................................
Andreas Mahn
dds GmbH
Stumpfstr.1 
76131 Karlsruhe
Germany
Tel.: +49 - (0)721 - 9651406
Fax: +49 - (0)721 - 9651419
http://www.dds.ptv.de/

.......................
[EMAIL PROTECTED]

>----------
>Von:   Tony Kelava[SMTP:[EMAIL PROTECTED]]
>Gesendet:      Dienstag, 2. Februar 1999 08:20
>An:    [EMAIL PROTECTED]
>Betreff:       MI SQl and Group By
>
>Hi all,
>
>I have a table as follows (example):
>
>ID   Dist   ID_2
>1    20    102
>1    24    103
>1    45    111
>
>I want to create a table that only contains the ID, minimum DISTvalue
>and associated ID_2 value.
>
>For example, new table ONLY contains the row of info:
>
>ID   Dist   ID_2
>1    20    102
>
>and disregards the other 2 rows.
>
>Can this be done easily. I have about 80,000 records in the database.
>
>Regards
>
>Tony
>----------------------------------------------------------------------
>To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
>"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
>
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to