Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Stored Procedure
Message
 
 
To
26/07/2010 14:21:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01473624
Message ID:
01473952
Views:
29
>>>From the quick glance there is nothing bad in the SP.
>>>
>>>1. What is your SQL Server version and do you have latest SP installed (SP3 for 2005)
>>>
>>>2. Did you try to probably split this query into 2 steps - step 1 - just select, no group by in CTE and step 2 - group by
>>>
>>>3. Did you close and re-open SSMS?
>>>
>>>4. Try passing dates in ISO format '20100601' '20100630'
>
>I cut one of the OR conditions out the SP and it ran. Problem must be that SQL 2005 does not like the OR in the WHERE clause

Try moving both criteria (both OR) into JOIN conditions. Having them in WHERE transforms your LEFT JOIN into Inner JOIN at present.

Check http://beyondrelational.com/blogs/naomi/archive/2010/03/22/why-left-join-doesn-t-bring-all-records-from-the-left-table.aspx
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform