Answers for "subtract two numbers myql"

SQL
0

how to subtract of two numbers in mysql

select sum(s0.w - s1.w) as total_weight_loss
from (select idMember, max(weight) as w from Measurements m
      where m.date = (select min(date)  from Measurements n
                      where m.idMember = n.idMember)
      group by idMember) s0
join (select idMember, min(weight) as w from Measurements m
      where m.date = (select max(date)  from Measurements n
                      where m.idMember = n.idMember)
      group by idMember) s1
on s0.idMember = s1.idMember
Posted by: Guest on January-07-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language