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 |
1sabine8
Posting Yak Master
130 Posts |
Posted - 2009-09-08 : 04:24:24
|
Hi,I need to build a graph that shows the count of records per customer. For each Customer, i need to show a bar for the number of records for the chosen month (filtered) and another bar for the previous month. For each customer on the x axis, i need to see the 2 bars. Is it feasible? How?Thanks in advance |
|
svicky9
Posting Yak Master
232 Posts |
Posted - 2009-09-08 : 17:09:42
|
yes..Its possible..GEt the sql query so that the fields are Customer, Records_CurrentMonth,Records_LastMonth.you can do the query likeselect a.customer,a.records as CurrentMonth,b.records as LastMonthfrom(select customer,records from tablewhere datepart(month,datecol) = currentmonthgroup by customer) ajoin(select customer,records from tablewhere datepart(month,datecol) = currentmonth - 1group by customer) bon a. Customer = b.CustomerOnce you get the results...drag a 2 bar chart and drop the fields..It should be straight forwardhttp://www.sqlserver007.com |
|
|
|
|
|