Hi All,
I want to add two tables into one using SQL-Select with "Union" which is as follows:
The thing is, it is very slow and not filtering the records in given dates.
Please note that hAccount is history file which contains 916,350 records and Account is the current file which as around 200,000 records.
Code is the master file contains the account heads and name.
The records in history file are from 01/01/2003 to 31/12/2016.
The records in current file are from 01/01/2017 till to-date.
dt1 = {01/01/2016}
dt2 = {31/10/2017}
Thanks
Saif
I want to add two tables into one using SQL-Select with "Union" which is as follows:
Code:
Select hAccount.creference, hAccount.cdate, hAccount.ccode, Code.full_name,;
hAccount.remarks, Code.chead, hAccount.debit, hAccount.credit;
FROM ;
village!hAccount ;
INNER Join village!Code ;
ON hAccount.ccode = Code.ccode;
UNION ;
Select Account.creference, Account.cdate, Account.ccode, Code.full_name,;
Account.remarks, Code.chead, Account.debit, Account.credit;
FROM ;
village!Account ;
INNER Join village!Code ;
ON Account.ccode = Code.ccode;
WHERE Between(cdate,md1,md2) ;
ORDER By cdate ;
INTO Cursor TempAct Readwrite
The thing is, it is very slow and not filtering the records in given dates.
Please note that hAccount is history file which contains 916,350 records and Account is the current file which as around 200,000 records.
Code is the master file contains the account heads and name.
The records in history file are from 01/01/2003 to 31/12/2016.
The records in current file are from 01/01/2017 till to-date.
dt1 = {01/01/2016}
dt2 = {31/10/2017}
Thanks
Saif