79176212

Date: 2024-11-11 02:24:14
Score: 1
Natty:
Report link

I'm currently moving my code from SQL Anywhere to MySQL. The cleanest method I found with MySQL is to use a variable to do the math and then assign the variable to an alias to show the results.

@val1 =  SUM(currentbalance), 
@val2 =  SUM(principal),
@val1+@val2 AS 'Total',
// to show the values at columns
@val1 AS 'current',
@val2 AS 'prin', 
   
Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Ron Simons