select sum(value) from (
select sum(insurance) / count(insurance) as value
from yourTableName
group by insurance
) temp;
Example run in mysql:
mysql> create table testTable (id int primary key auto_increment, orderno varchar(12), insurance decimal(6, 2));
Query OK, 0 rows affected (0.27 sec)
mysql> insert into testTable (orderno, insurance) values ('ABC123', 3), ('ABC123', 3), ('ABC123', 3), ('DEF456', 2), ('DEF456', 2);
Query OK, 5 rows affected (0.00 sec) Records: 5 Duplicates: 0 Warnings: 0
mysql> select * from testTable;
+----+---------+-----------+
| id | orderno | insurance |
+----+---------+-----------+
| 1 | ABC123 | 3.00 |
| 2 | ABC123 | 3.00 |
| 3 | ABC123 | 3.00 |
| 4 | DEF456 | 2.00 |
| 5 | DEF456 | 2.00 |
+----+---------+-----------+
5 rows in set (0.00 sec)
mysql> select sum(value) from (
select sum(insurance) / count(insurance) as value
from testTable
group by insurance ) temp;
+------------+
| sum(value) |
+------------+
| 5.000000 |
+------------+
1 row in set (0.02 sec)