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 |
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2010-12-09 : 13:45:50
|
| i am trying to make a query that will compare data from dec 2009 and 2010select convert(char(10), orderdate, 120) as orderdate, count(*) from orders where orderdate between '12/01/2010' and '12/31/2010'group by convert(char(10), orderdate, 120)order by orderdatethis query give me the counts for one year -- i would like to have both 2009 and 2010 counts and have the difference as a percentagehow can i do that? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-12-09 : 14:01:30
|
do u mean this?select year(orderdate) as orderyear, count(*) from orders where orderdate between '12/01/2009' and '12/31/2010'group by year(orderdate)order by orderyear ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
tpiazza55
Posting Yak Master
162 Posts |
Posted - 2010-12-09 : 14:21:31
|
| im looking for something like 11/1 500 1000 200% |
 |
|
|
|
|
|