>Hello,
> I have 2 tables, both tables contain some fields. One table contains all the current transactions and the other holds all the old transactions. Can anyone tell me what is the best way to retrieve 5 latest transactions on a specific account ?? thanks
Are the tables identical in structure? If so, a UNION clause to join the results of both tables might be helpful.
Eg: two tables, oldrecs and newrecs, identical in structure:
SELECT 0
USE OldRecs
FOR nI = 1 TO FCOUNT()
IF UPPER(FIELD(nI)) = "TRANSDATE"
EXIT
ENDIF
ENDFOR
SELECT TOP 5 * FROM OldRecs ;
INTO CURSOR allRecs ;
WHERE RecID = MyTargetKeyValue ;
UNION ALL ( ;
SELECT * FROM NewRecs ;
WHERE RecID = MyTargetKetValue ;
ORDER BY nI )
*