Please read Bahmni Reporting Overview first.

Custom SQL Reports allow writing a specific SQL that executes on MRS, ELIS or Odoo. This will query the database directly. It is only recommended for tricky use-cases / edge cases where generic reports don’t suffice.

Please read detailed documentation & examples here: Reporting Overview (Bahmni)