this is the sql statement (modified) I'm using in VBSelect gl.ID1 as ID1, gl.ID2 as ID2, field1 as alias1, field2 AS EIN, field3 as alias2, gl.field4 as aliasDate1, case gl.field5 When '1/1/1900' then '12/31/2099' else gl.field5 end as aliasDate2, glc.field6 as aliasDate3, glc.field7 as aliasDate4, field8 as alias3, field9 as alias4 from tblMaster gl inner join tblDetail1 glc on gl.ID1 = glc.ID1 and gl.ID2 = glc.ID2inner join tblDetail2 glp on glp.ID1 = gl.ID1 and glp.ID2 = gl.ID2Where @VBBuildCriteriaOrder by gl.ID1, gl.ID2, glc.field6, glc.field7
All three tables have PK defined and no extra indexestblMaster pk = ID1 char(5), ID2 char(5)tblDetail1 pk = ID1 char(5), ID2 char(5), field6 datetime, field7 datetimetblDetail2 pk = ID1 char(5), ID2 char(5), type tinyintcan you make sugestion about the indexes?*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*A candle loses nothing by lighting another candle