U
UnderGround
Hi ,
I have a simple query but there are too many records in the database
around 90630 that is making the query to time out. The sql for the
query is..
INSERT INTO TblDbSinksBasinOrder ( JobNumber, OrderID, DateRecAdded )
SELECT tblSinkBasin.JobNumber, tblSinkBasin.ID, Date() AS DateRecAdded
FROM tblSinkBasin
WHERE (tblSinkBasin.ID Not In (select OrderID from TblDbSinksBasinOrder
where orderID is not null));
I just want to add records form the tblSinkBasin table into
TblDbSinksBasinOrder table but i only want to add records that are not
already in TblDbSinksBasinOrder. The TblSinkBasin table get new records
every day.
The only way that i could think of doing it that might work was to add
a dateRecordWasAdded field in the tblSinkBasin table so there is a date
for every record. now when i run my query run a sun query to get the
max date that is in tblDBSinksBasinOrder table and then get all the
recods from TblSinksBasin which are greater than that date.
I would like to avoid this as i do not want to add a new field in
TblSinkBasin.
Any advice??
Thanks in advance
I have a simple query but there are too many records in the database
around 90630 that is making the query to time out. The sql for the
query is..
INSERT INTO TblDbSinksBasinOrder ( JobNumber, OrderID, DateRecAdded )
SELECT tblSinkBasin.JobNumber, tblSinkBasin.ID, Date() AS DateRecAdded
FROM tblSinkBasin
WHERE (tblSinkBasin.ID Not In (select OrderID from TblDbSinksBasinOrder
where orderID is not null));
I just want to add records form the tblSinkBasin table into
TblDbSinksBasinOrder table but i only want to add records that are not
already in TblDbSinksBasinOrder. The TblSinkBasin table get new records
every day.
The only way that i could think of doing it that might work was to add
a dateRecordWasAdded field in the tblSinkBasin table so there is a date
for every record. now when i run my query run a sun query to get the
max date that is in tblDBSinksBasinOrder table and then get all the
recods from TblSinksBasin which are greater than that date.
I would like to avoid this as i do not want to add a new field in
TblSinkBasin.
Any advice??
Thanks in advance