(MySQL) ROUND - stell mich an :(

sycorax

Grünschnabel
Hallo zusammen,

ich stell mich a bissl an... Hoffe ich finde hier eine Lösung.
Habe folgendes SQL Statement und möchte den %Wert "gesamtc" mit nur 2 Nachkommastellen ausgeben.
Leider schaffe ich es nicht, die Funktion ROUND an die richtige Stelle zu setzen :(

-----------------------------------------
select
`metric`.`kyct_compl_rate`.`iriweek` AS `iriweek`,
`metric`.`owners`.`leader` AS `leader`,

avg(
(`metric`.`kyct_compl_rate`.`approved` + `metric`.`kyct_compl_rate`.`unkeycat`)
*100
/ `metric`.`kyct_compl_rate`.`gesamt`) AS `gesamtc`

from
(`metric`.`kyct_compl_rate` join `metric`.`owners` on((`metric`.`owners`.`ownerid` = `metric`.`kyct_compl_rate`.`ownerid`)))

group by
`metric`.`kyct_compl_rate`.`iriweek`,
`metric`.`owners`.`leader`
;
-----------------------------------------

Würde mich super freuen ...:)
Danke
 
Hallo sycorax,

statt

SQL:
avg(
(`metric`.`kyct_compl_rate`.`approved` + `metric`.`kyct_compl_rate`.`unkeycat`)
*100
/ `metric`.`kyct_compl_rate`.`gesamt`) AS `gesamtc`

versuch doch mal:

SQL:
ROUND(AVG(
(`metric`.`kyct_compl_rate`.`approved` + `metric`.`kyct_compl_rate`.`unkeycat`)
*100
/ `metric`.`kyct_compl_rate`.`gesamt`),2) AS `gesamtc`

Markus
 

Neue Beiträge

Zurück