Re: Select problem
Hi, At 01:52 pm 2/03/2001, Thalis A. Kalfigopoulos wrote: >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 Thanks for your reply. This is not quite what I'm after. Count(sales) gives me the number of sales transactions. The first two cols I write as monthname(date_col) as Month, sum(sales) as Sales It's the next column that's got me. That needs to be a "Running total" if you like. Richard === Richard Vibert [EMAIL PROTECTED] Tatura Mitre10 === - 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
Select problem
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 === Richard Vibert [EMAIL PROTECTED] Tatura Mitre10 === - 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
LOAD_FILE /TEXT
Hi, I'm storing a text file in a TEXT column using the LOAD_FILE function like this: INSERT ... text_col=LOAD_FILE('filename') Each line of the orig file ends with char 10. When I SELECT it like SELECT text_col INTO OUTFILE 'out_filename' ... I find that each line has an extra "\" (char 92) inserted as the second last char, the last char being char 10. I've searched through the manual and can't find mention of this, am I missing something?? Richard ======= Richard Vibert [EMAIL PROTECTED] Tatura Mitre10 === - 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