MySqlDataAdapter sda = new MySqlDataAdapter(String.Format( "SELECT datetime ," + "sum(CASE action when '2' then 1 else 0 end) as AcceptedIMG, " + "sum(CASE action when '3' then 1 else 0 end) as RejectedIMG, " + "sum(CASE action when '4' then 1 else 0 end) as ChangeIMG " + "FROM customer_1.audit_trail " + "where datetime BETWEEN '{0}' and '{1}'", start.Value.ToString("yyyy/MM/dd"), end.Value.ToString("yyyy/MM/dd") ), conn)