I do similar work and have found that exporting all the data into either
a spreadsheet program or database program works easiest and fastest for
me. Perhaps it will work for you too.

Elizabeth Caponi

-----Original Message-----
From: Susan Yu [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 8:18 PM
To: [EMAIL PROTECTED]
Subject: MI-L [New Question] RE: MI-L Select Highest Value only in Table
- Multiple Records

Hello everyone,

I have a follow-up question since I'm doing something similar.  I hope
someone has a simple answer that I'm not seeing.

What if I wanted to select the RECORD with the highest value from a
certain column?

I have multiple columns where they would all have a value with the same
IDs.  But not all the columns are consistantly the highest value.

For example:

ID     ValueA     ValueB    ValueC
XYZ    20         30        40
XYZ    30         15        20
XYZ    40         11        10
ABC    50         20        17
ABC    22         30        10


I would like to select only the records where ValueA is the higest
(regardless of the values in ValueB and ValueC)
I would like this result:

ID     ValueA     ValueB    ValueC
XYZ    40         11        10
ABC    50         20        17

I'm worried that if I used "group by ID", the query will return the ID,
with the highest ValueA, but randomly pick the values for ValueB and
ValueC.

Is there a solution?  I would be grateful for any help.

Thanks,
Susan




------------------------------------------

From: Cowper, Brian [mailto:[EMAIL PROTECTED]
Date:   05-10-2004 13:37

Thanks Steve, that worked and thanks also to everyone else who came up =
with solution, I'm very impressed with the quick responses. I'll be back
=
again when I hit that next wall!

Brian

-----Original Message-----
From: Wallace, Steve [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 4:19 PM
To: Cowper, Brian
Subject: RE: MI-L Select Highest Value only in Table - Multiple Records


Select WellID, Easting, Northing, Max(DepthFrom), Max(DepthTo)
>From YourTableName
Group by WellID, Easting, Northing

Try that.
-- Steve=20

-----Original Message-----
From: Cowper, Brian [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 04:16 PM
To: MapInfo-L (E-mail)
Subject: RE: MI-L Select Highest Value only in Table - Multiple Records

Thanks to all who have responded.

The solutions I have so far show me how to make the data in column =
DepthFrom
descending or show overall statistics, but that's not what I need.

To clarify - each Well has multiple rows, take for instance my example
below, there are three rows of data for Well 0001, I want strip out the
=
2
rows that contain lower elevations and be left with row that has the =
highest
DepthFrom value (250) and it is the same for all the other records, so =
with
Well 0002, I would be left with row that has the 265 elevation, for Well
0003 an elevation of 239, etc.

WellID Easting Northing DepthFrom Depthto

0001 50000 400000 250 240
0001 50000 400000 240 220
0001 50000 400000 220 210
0002 50050 400025 265 255
0002 50050 400025 255 230
0003 50070 400005 239 228
0003 50070 400005 228 213
etc...

What I need to do is extract from this table the records with the =
highest
DepthFrom value. So I would end up with this table after running my =
query:

0001 50000 400000 250 240
0002 50050 400025 265 255
0003 50070 400005 239 228

TIA

Brian

-----Original Message-----
From: Mcinnis, Michael [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 3:47 PM
To: Cowper, Brian
Subject: RE: MI-L Select Highest Value only in Table - Multiple Records


Something like this will work:

Select Top 10 From Wells Order By Depthto desc



-----Original Message-----
From: Cowper, Brian [mailto:[EMAIL PROTECTED]
Sent: Monday, May 10, 2004 12:26 PM
To: MapInfo-L (E-mail)
Subject: MI-L Select Highest Value only in Table - Multiple Records


I have a table containing thousands of point locations which represent =
Water
Well Locations, the Well in the following format:

WellID Easting Northing DepthFrom Depthto

0001 50000 400000 250 240
0001 50000 400000 240 220
0001 50000 400000 220 210
0002 50050 400025 265 255
0002 50050 400025 255 230
etc...

What I need to do is extract from this table the records with the =
highest
DepthFrom value. So I would end up with this table after running my =
query:

0001 50000 400000 250 240
0002 50050 400025 265 255

Is there any easy way to achieve this using SQL select or select, or do
=
I
have to create a piece of code for this? I should add that I'm very =
green
with MI 7.0 and haven't looked into MapBasic at all.


Regards,

BChrisCo



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com | =
To
unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11672

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11673

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11677


-----------------------------------------
This email was sent using http://cafemail.dcccafe.com .

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11724


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11739

Reply via email to