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.