Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Slow data retrieval
Message
 
 
To
18/07/2008 12:54:01
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01332178
Message ID:
01332329
Views:
7
You're welcome.

>Thank you again Sergery.
>You are a Star!
>
>
>
>>>Thanks a lot. Sergey.
>>>
>>>I replaced
>>>
ON m.f_year + m.type_code + m.sal_no = d.f_year + d.type_code + d.sal_no
>>>with
>>>
ON m.f_year = d.f_year AND m.type_code = d.type_code AND m.sal_no = d.sal_no
>>>It changed everything. I got 6200 in just matter of seconds.
>>>
>>>1. What's the difference between them?
>>
>>I explained it in my prevous message.
>>
>>> If the first 1 is not correct then why SQL accepts it?
>>
>>It's valid expression but it's used incorrectly by you
>>
>>>2. I am overusing LEFT OUTER JOINs what's the alternet?
>>
>>Only use them when you have to
>>
>>>3. Everytime i format the query and save it in View Desigener and reopen It looses my format.
>>
>>I do not use View Desigener or Query Designer for that reason.
>>
>>>
>>>
>>>
>>>>It seems that you're overusing LEFT OUTER JOINs. Do you really need all of them to be such?
>>>>All JOIN expressions are incorrect. SQL Server does not have compound indexes so they cannot be optimized. The join should be on each column separately
>>>>
>>>>INNER JOIN dbo.sal_dtl AS d
>>>> 	ON m.f_year + m.type_code + m.sal_no = d.f_year + d.type_code + d.sal_no
>>>>
>>>>-- should be
>>>>
>>>>INNER JOIN dbo.sal_dtl AS d
>>>> 	ON m.f_year = d.f_year AND m.type_code = d.type_code AND m.sal_no = d.sal_no
>>>>
>>>>-- and so on
>>>>
>>>>
>>>>I also would recommend to reformat the query for readability.
>>>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform