SELECT sim.MODE_OF_SERVICE, (SELECT Price_List_Name from $master_db.Price_Lists where Price_List_ID=sim.MODE_OF_SERVICE)as 'Mode',  SUM(Total) as 'Total' from $trans_db.Sales_Invoice_Main sim where  ( `TimeStamp`>=str_to_date('$fromDateTime','%Y-%m-%d %H:%i:%s') and `TimeStamp`<= str_to_date('$toDateTime','%Y-%m-%d %H:%i:%s')) group by MODE_OF_SERVICE