Paradox Community

Items in pnews.paradox-programming

Subject:TOP 5
Date:16 Jul 2020 23:00:23 -0400
From:"Kevin Zawicki" <>

I have two tables A and B.
each has a unique part # column

There is item name table with the part # and then two tables with part #
and sub part #

M part# and info
A active   part#, subpart#
B retired  part#, subpart#

A list of parts, and one table with active subparts of the part, one table
with the retired subparts on the part.

subparts are unique and a subpart cannot be in both tables

each subpart "child table" has a date column
each part may have zero to many subparts in either table

I need to get the last x number (3-5) subparts by date from both tables.

If I have part 12345 and want the get the latest 5 entries by date and they
may be in A or B or both.

I can query and collect from both tables and then sort and grab top 5.

But this may put 100s of rows in the collection table just to get the top

Using QBE or local SQL is there a better way to get the latest 5?

Even if I get the latest 5 from A and latest 5 from B (if they have 5) then
latest 5 from collection it would be more efficient than getting the entire
set of subparts.

Is there a way to do TOP 5 in local SQL?

Copyright © 2004