Hi All,

I am getting performance issue when i run the following query. Its taking 5 to 8 min to provide the data.

City table contains 45000 records.
State table contains 500 records
Country table contains 300 records

Now the Query as follows......

SELECT distinct
F.fileid as 'Fileid',
F.FileName as 'File Name',
D.Zip as 'Zip',
D.City as 'City',
D.State as 'State',
D.Country as 'Country',
D.AddressTypeID as 'AddressTypeID'
lap_file F ,lap_filedatarecord L, lap_datarecord_address D
WHERE F.fileid=L.fileid
AND L.filedatarecordid=D.filedatarecordid
AND F.batchid=20
AND D.addresstypeid=1
AND (d.zip NOT IN
(SELECT zip FROM lap_City lc where lc.cityname=d.city and lc.stateid
IN (select stateid from lap_state ls where ls.statecode=d.state)));

Please provide me the answer.

Thank You

Aruna Mathew