Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get a Top n dataset grouped.
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00680116
Message ID:
00681558
Views:
25
< snip >>
>Hi
>I'm afraid it will become too complcated and slow-running query but you caould try somethink like this:
>
 SELECT t.LotNumber, t.Container, t.Lot_Pieces, t.Lot_Balance FROM MyTable t
>     WHERE t.LotNumber IN (SELECT top 3 sq.LotNumber, sq.Container, sq.Lot_Balance
>                          FROM MyTable sq
>                          WHERE sq.Container = t.Container )
>
First, in VFP SELECT TOP n requires ORDER BY clause. Second, such subquery would generate an error.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform