SELECT
`med_items`.`namelab`
,`med_unit`.`name`
,`med_items`.`unitprice`
,`med_receive_order`.`med_amount` AS num2
,(`med_items`.`unitprice`*`med_receive_order`.`med_amount`) AS price2
,(`med_cal`.`remain`+`med_receive_order`.`med_amount`) AS num3
,((`med_items`.`unitprice`*`med_cal`.`remain`)+(`med_items`.`unitprice`*`med_receive_order`.`med_amount`) )AS price3
,`med_inorder`.`confirm` AS num4
,`med_cal`.`remain`AS num5
,(`med_items`.`unitprice`*`med_cal`.`remain`) AS price5
FROM
`med_receive_order`
Inner Join `med_items` ON `med_receive_order`.`med_idlab` = `med_items`.`med_items_id`
Inner Join `med_unit` ON `med_unit`.`med_unit_id` = `med_items`.`idunit`
Inner Join `med_cal` ON `med_receive_order`.`med_idlab` = `med_cal`.`med_idlab`
Inner Join `med_inorder` ON `med_receive_order`.`med_idlab` = `med_inorder`.`idlab`
WHERE
`med_cal`.`date_update` BETWEEN '2017-02-01' AND '2017-02-31'
GROUP BY
`med_receive_order`.`med_idlab`
ORDER BY
`med_items`.`med_items_id` DESC