Monday, March 12, 2012

Group by week

Is there an easy way to group data by week?Try this (in order to consider year also, if you have data that spread across multiple years):

group by ltrim(rtrim(str(datepart(week,[date field]))))+ltrim(rtrim(str(datepart(year,[date field]))))

IONUT|||group by datepart(yy, dte), datepart(ww,dte)|||Thanks for the quick reply. One other question!

What is the best book (for someone that is new and has a tough time understanding people who really know the subject and want to impress everyone with there wisdom by talking over newbe's head) for those who want to learn stored procedures in order to do a better job of programing?|||In my opinion there are no such things as good books for learning something. There only may be books that give you an ideea, a start, fundamentals about what can be done with a tool (generally speaking). And these problems are covered in almost all books I have seen so far.

The best way of learning something is to face it. Take one real problem at a time at try work it out. For this you may use available help (the first thing to try), internet, ask someone who faced your kind of problem before you or , yes, you may use books. But you can read books for ever, the only thing that you may acomplish is to know by heart all what's inside them. Without really trying programming something ?|||Originally posted by ionut calin
The best way of learning something is to face it. Take one real problem at a time at try work it out. For this you may use available help (the first thing to try), internet, ask someone who faced your kind of problem before you or , yes, you may use books. But you can read books for ever, the only thing that you may acomplish is to know by heart all what's inside them. Without really trying programming something ?

I Could'nt Agree More

No comments:

Post a Comment