I have 2 tables: table1 and table2 (simple enough).
Table1's structure is like this:
id identity,
scode text
sdate datetime
loc1 varchar,
loc2 varchar,
direction varchar,
distance
table2 has following structre:
id identity,
scode varchar -> relates to table1 by scode,
filename varchar
scode in table2 can have one or more files.
so when a record is inserted into table2, we could have a value like:
ID Scode filename
1 321 file1
2 321 file2
3 321 file3
4 321 file4
--------------------------------
ID Scode filename
5 322 file5
6 322 file6
--------------------------------
etc, etc
I wrote the following query:
SELECT fctrafic.sitecode,date,location,location2.direction,distance,trafficCountsFiles.filename FROM trafficCountsFiles Left Join fctrafic ON fctrafic.siteCode = trafficCountsFiles.SiteCode
where FileName <> 'z'
But it is taking forever.
Can someone please help me tune this.
Thanks in advance
Table1's structure is like this:
id identity,
scode text
sdate datetime
loc1 varchar,
loc2 varchar,
direction varchar,
distance
table2 has following structre:
id identity,
scode varchar -> relates to table1 by scode,
filename varchar
scode in table2 can have one or more files.
so when a record is inserted into table2, we could have a value like:
ID Scode filename
1 321 file1
2 321 file2
3 321 file3
4 321 file4
--------------------------------
ID Scode filename
5 322 file5
6 322 file6
--------------------------------
etc, etc
I wrote the following query:
SELECT fctrafic.sitecode,date,location,location2.direction,distance,trafficCountsFiles.filename FROM trafficCountsFiles Left Join fctrafic ON fctrafic.siteCode = trafficCountsFiles.SiteCode
where FileName <> 'z'
But it is taking forever.
Can someone please help me tune this.
Thanks in advance