|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
T-SQL, Group By something that is not a column name?
I am trying to create a stored procedure that will look at a list of transactions and from that provide totals per-month, based on a full date (i.e. dd-mm-yyy).
I.e., in pseudo-code, select the sum of a column, and group it by Month, where month is derived from a date field that stores a full date. Is there a way to do this? |
|
#2
|
||||
|
||||
|
Code:
select month(datefield)
, sum(acolumn)
from yourtable
group
by month(datefield)
|
|
#3
|
|||
|
|||
|
Perfect - thanks rudy
![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > T-SQL, Group By something that is not a column name? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|