April 27, 2009 at 3:19 am
Hi
I have a query that produces metrics from a unioned view that contains page syslogs for a website.
The problem I have is that I have written 2 versions of the same query, one runs over a month period and the other goes over the past year and groups by year and month. The problem is that both queries, when referencing the same month, are producing different results. I have gone through several methods of grouping on the month and year with no luck. I simply cannot understand why it doesn't work !
Both queries are identical apart from the date range restriction and the grouping, unfortunately I can't post the entire queries here for commercial reasons.
The date range and grouping is shown below:
and (
GROUP BY dateadd(month, datediff(month, 0,
Any ideas ?
Thanks in advance
Steve
April 27, 2009 at 4:24 am
Hi Steve,
Post your full statement which you write
Meanwhile try this
select year(order_Dt),month(order_Dt),count(order_No) from Order_table
where order_Dt between dateadd(year,-1, getdate()) AND getdate()
GROUP BY year(order_Dt),month(order_Dt)
ORDER BY year(order_Dt),month(order_Dt)
ARUN SAS
April 27, 2009 at 4:46 am
I'll knock up and equiv query.
In the meantime I may have resolved it - there was inconsistent bracketting of restrictions so I think that was producing some funky joins ...
April 27, 2009 at 5:47 am
my bad. it was a bracketting problem. doh.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply