On Fri, 2 Mar 2001, Richard Vibert wrote:
> Hi,
>
> I having trouble working out how to get a result set similar to the
> following where I select from a table with Date & Sales column.
>
> My specific question is can I have a column that accumulates values, if so
> could I have some guidance on how to express this in a select statement please.
>
>
> +----------+-----------+-----------+
> | Month | Sales | Cum Sales |
> +----------+-----------+-----------+
> | Jan | 1000 | 1000 |
> | Feb | 1500 | 2500 |
> | Mar | 1200 | 3700 |
> | April | 1400 | 5100 |
> +----------+-----------+-----------+
>
> Many thanks in advance.
>
> Richard
I assume the query should be like:
select MONTHNAME(date_col) as Month,count(sales_amount) as Sales,sum(sales_amount) as
Cum_sales from lala_table group by MONTHNAME(date_col);
regards,
thalis
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php