MySQL Forums
Forum List  »  German

per Formel aus Feld Werte berechnen
Posted by: Jürgen Fabian
Date: December 09, 2014 02:21AM

Hallo Zusammen,

ich habe

in Tabelle A die Spalten
id | formula | name
----------------------------------
1 | (`100`+`200`) | Umsatz

in Tabelle B die Spalten

mandant | mon | jahr | 100 | 200
-------------------------------------
0001 | 1 | 2014 | 59.80 | 104.5

Nun möchte ich aus Tabelle B die Werte aus Spalte 100 und 200 zusammenrechnen. Jedoch soll die Formel dazu aus Tabelle A übernommen werden.

Das Statement

SELECT formula AS SUM_Umsatz, Name FROM A
JOIN B ON B.id = 1
WHERE mandant = '0001' AND mon = 1 AND jahr = 2014

Gibt lediglich

SUM_Umsatz | Name
---------------------------
(`100`+`200`) | Umsatz

zurück.

Gibt es eine Möglichkeit die Formel aus A so in das Statement einzubinden, das MySQL diese als Berechnungsformel erkennen kann. oder ggf. als Function, die als Parameter die id mandant mon jahr erhält?

Grüße und Danke vorab
Jürgen

Options: ReplyQuote


Subject
Views
Written By
Posted
per Formel aus Feld Werte berechnen
2609
December 09, 2014 02:21AM


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.