Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get a Top n dataset grouped.
Message
De
18/07/2002 14:17:00
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
How to get a Top n dataset grouped.
Divers
Thread ID:
00680116
Message ID:
00680116
Vues:
62
Hi everybody!,

Is there a way to get with a sql statement the first top n rows of every filtered group?.Let me explain a little bit. I have a table with next fields:

LotNumber,Container,Lot_Pieces,Lot_Balance
40134456,10101011,1000,80
40134457,10101011,1000,60
40334458,10101011,1000,20
40344458,20101011,1020,1020
40134558,20101011,400,10
40134758,20101011,800,759
40134858,20101011,1500,30
40134958,20101011,1500,30
..
..
50134458,80101011,400,400
60134455,80101011,400,300
70133458,80101011,800,5
8013438,80101011,320,20
90134488,80101011,2500,2


I will like to get the first 3 records of every container that meets the next rule: Lot_balance<100
Data Result
40134456,10101011,1000,80
40134457,10101011,1000,60
40334458,10101011,1000,20

40134558,20101011,400,10
40134858,20101011,1500,30
40134958,20101011,1500,30

70133458,80101011,800,5
8013438,80101011,320,20
90134488,80101011,2500,2

Thanks in advance
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform