0

この MySQL コードにトリガーを適用できますか?

SELECT name, cost AS originalCost, whenacquired, monthsDepreciated, monthlyDepreciation, 
       monthsDepreciated * monthlyDepreciation AS totalDepreciation,
       cost - monthsDepreciated * monthlyDepreciation AS depreciatedValue
FROM (
    SELECT name, 
           cost,
           whenacquired, 
           (YEAR(NOW())*12 + Month(NOW())) - ( YEAR(whenacquired)*12 + Month(whenacquired)) AS monthsDepreciated,
           cost / ( life * 12 ) AS monthlyDepreciation
    FROM assets
    ) AS X
ORDER BY whenacquired;

はいの場合、提案をいただければ幸いです

4

0 に答える 0