SaveText.Ru

h
  1. select  `id`, `quadrant_name`, CAST(`total_money` AS unsigned ) as total,CAST(`required_m_n` AS unsigned ) as mn,CAST(sum(`paid_num`) AS unsigned ) as sum_paid,CAST(min(`remaining_payments`) AS unsigned) as min_rem
  2. from `table`
  3. where (select MAX(`total_paid`) = `required_m_n` where (select MIN(`remaining_payments`) > 0 ) )  
  4.  group by  `quadrant_name`
  5.  
  6.  

Share with your friends:

Print