MySQL Forums
Forum List  »  General

Re: cummulated share of Turnover within article group
Posted by: Manfred Engleitner
Date: April 14, 2016 10:46AM

Dear Experts,

if someone of you needs the same solution - here you are:

CREATE DEFINER=`root`@`localhost` PROCEDURE `prc_match_fill_vpw_art_kumumsatz_calc`()
BEGIN

SET @kumumsatz = 0;
SET @wgr_prev = 00001;

INSERT INTO tblmatch_vpw_art_kumumsatz

(`Warengruppe`,
`Hauptmaterial`,
`kum Umsatzanteil`)

SELECT `Warengruppe`, `Hauptmaterial`, CASE
WHEN @wgr_prev = `Warengruppe` THEN @kumumsatz := @kumumsatz + `Umsatzanteil`
WHEN @wgr_prev := `Warengruppe` THEN @kumumsatz := `Umsatzanteil`
END AS `kum Umsatzanteil`

FROM qry_match_umsatzanteil_vpw_art_form;

END

Greetings
Manfred

Options: ReplyQuote


Subject
Written By
Posted
Re: cummulated share of Turnover within article group
April 14, 2016 10:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.