Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieving complete row with MIN()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00503015
Message ID:
00503037
Vues:
25
Hi!
SELECT pat_handle, last_name, first_name, gender,;
       scantype, site, label, side, facility_i,;
       Birth_time, Physician, Comments, Acq_time,;
       BMD, Fracture_r, Percent_ya,;
       Percent_am, Zsco_bmd_y, Zsco_bmd_a;
  FROM working;
  WHERE BMD IN ;
    (SELECT MIN(BMD) FROM working;
  WHERE scantype=19 AND (LABEL=4 OR LABEL=0) )
HTH.

>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
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform