Select
	SorterName,InductName,Total_count,Startstamp,Endtstamp,
	Total_count/Total_count as Total_perc,
    Total_count*3600/TIMESTAMPDIFF(second, Startstamp, Endtstamp) as Total_rate
FROM
	(SELECT 
		  'S03' as SorterName,
		  'Induct 1' as InductName,
		  COUNT(*) AS Total_count,
		  MIN(alltable.t_stamp) AS Startstamp, 
		  Max(alltable.t_stamp) AS Endtstamp
		  
FROM alltable
		Where (alltable.t_stamp BETWEEN :starttime AND :endtime)
		Group BY 'Induct 1' ) basa