Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
SunnyDee
Yak Posting Veteran
79 Posts |
Posted - 2005-05-10 : 19:13:41
|
| Hello SQL Gurus:I'm new to TSQL, so this is probably not the smartest question, but I inherited the code below. I'm only posting part of this code, as the query is very long...In the WHERE CLAUSE, c.fkUser=@fkUser and intRecycleBin=0 and chrExtractFileName is not null and c.fkReport=@fkReport is stated correctly. Is there a reason it needs to be restated in the LEFT JOIN and again at the end of the WHERE clause? Will this have an impact on performance? Some of the tables are very large.[CODE]Select 'Bulk Records (Estimated Prec ' as Item, b.monValue , a.Total_Count as Counts, '1' as Sort_Orderinto #TotalTempTablefrom (Select distinct Count(a.chrAppNo) as Total_Count, a.fkReportYearfrom tbl_MAIN as a inner join tbl_Codes1 as b on a.fkCode=b.pkCode left join tbl_Report_Key as c on a.pkGuid=c.fkGuidKey and c.fkuser = @fkuser and c.fkreport = @fkreportWhere c.fkUser=@fkUser and intRecycleBin=0 and chrExtractFileName is not nulland c.fkReport=@fkReportand (b.chrPrecision='B1' or b.chrPrecision='B2' or b.chrPrecision='B3' or b.chrPrecision='B5' or b.chrPrecision='B6' or b.chrGPrecision='B7')and ((c.fkuser = @fkuser and c.fkreport = @fkreport) or xintRouteTrigger = 0)group by a.fkReportYear)as a left join tbl_Report_Reference as b on b.fkReportYear=a.fkReportYearWhere b.chrName='Bulk Precision'union [/ENDCODE]Thanks for any suggestions. |
|
|
|
|
|