En/na Mark A. Parsons ha escrit:
> Since you don't have any sort of aggregation (sum(), count()) functions
> for grouping (see Daniel's post), I'd have to ask what you mean by "i
> want to be able to group by months"?
because that is a very stripped down version of what i'm actually trying
to do. anyway, i've sorted it out now.
think about doing something like (take a look at the new field using count):
create view
sybtestview
as
select
(
convert(varchar(4),datepart(yy,mydate))
|| '-'
|| convert(varchar(2),datepart(mm,mydate))
) sybdate
,count(mydate) as countdate
from sybtest
group by
(
convert(varchar(4),datepart(yy,mydate))
|| '-'
|| convert(varchar(2),datepart(mm,mydate))
)
this would count the records for each month and it would present the
results this way:
sybdate countdate
--------- ----------
2005-11 3
2005-12 1
2006-1 4
i think this is really useful!!!

alex.