Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving complete row with MIN()
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Retrieving complete row with MIN()
Miscellaneous
Thread ID:
00503015
Message ID:
00503015
Views:
64
Hi...I've got a query:

SELECT pat_handle, last_name, first_name, gender,;
scantype, site, label, side, facility_i,;
Birth_time, Physician, Comments, Acq_time,;
MIN(BMD), Fracture_r, Percent_ya,;
Percent_am, Zsco_bmd_y, Zsco_bmd_a;
FROM working;
WHERE scantype=19 AND (LABEL=4 OR LABEL=0)

I want to retrieve the row that has the lowest (i.e. MIN() BMD. However, what the query is retrieving apparently, is the the four rows that meet all of the criteria in the WHERE clause, and then displaying the lowest value in the BMD field and data in the other fields from the bottom record of the retreived group of records. In other words, the single row that is displayed mixes data from more than one record. Odd this.

What I think I want is something like, WHERE scantype=19 AND (LABEL=4 OR LABEL=0)AND MIN(BMD)...however, this generates an error.

Is there a more elegant way to do this?

TIA,

--- Larry
-- Larry Keyes
Remember only You can prevent Gray Goo. Never release nanobot assembers without replication limiting code.
Next
Reply
Map
View

Click here to load this message in the networking platform