Translating raw SQL into elixir

Hi Developers, how can i this type of query be written in elixir. The only thing ive managed to do is put the same query in an elixir function it only works in MSSQL database but if i change to a database like Postgres it crashes. So i wanted an elixir ecto query. That can work like that. Any assistance will be highly appreciated.
SELECT ‘Unit Trust Funds’“module_name”, COUNT (*) AS record_counts

              FROM [funds_mgt_dev].[dbo].[tbl_unit_trust_funds] WHERE auth_status = 'U'

            UNION

            SELECT 'Account Enquiries'"module_name", COUNT (*) AS record_counts

              FROM [funds_mgt_dev].[dbo].[tblm_account_enquiries] WHERE auth_status = 'U'

the output of this table is as follows;

| |module_name | record_counts |

| Unit Trust Funds | 1 |

| Account Enquiries | 0 |

That query should be possible with union and count

1 Like

Thanks alot mbuhot. It worked

1 Like