I need to find value in b_id which repeats for maximum time. for example query for the table below should return 40 (n.b., query should return a single value)
| b_id | s_id | doi | dos | charge | +------+------+------------+------------+--------+ | 10 | 3 | 0000-00-00 | 0000-00-00 | 200 | | 10 | 2 | 0000-00-00 | 0000-00-00 | 200 | | 20 | 1 | 0000-00-00 | 0000-00-00 | 200 | | 30 | 2 | 0000-00-00 | 0000-00-00 | 200 | | 40 | 4 | 0000-00-00 | 0000-00-00 | 200 | | 40 | 5 | 0000-00-00 | 0000-00-00 | 200 | | 70 | 5 | 0000-00-00 | 0000-00-00 | 200 | | 40 | 4 | 0000-00-00 | 0000-00-00 | 200 |
edit:
ups, mysql equivalent:
edit2:
after the comment: