I have a PostgreSQL query that I need to convert to Lamba exp or LINQ to use in my ASP.NET Core C# project. Furthermore, the name of the table is "DeliveryFinances".
This is my PostgreSQL query
SELECT t1."DriverId", t2."OrderNo", COUNT(*)
FROM public."DeliveryFinances" t1
JOIN
(
SELECT MIN("OrderNo") AS "OrderNo", "DriverId"
FROM public."DeliveryFinances"
GROUP BY "DriverId"
) t2 ON t1."DriverId" = t2."DriverId"
GROUP BY t1."DriverId", t2."OrderNo"
LIMIT 25
This is the result I get after running the query in pgAdmin
| DriverId| OrderNo | count |
|----------------------------
| 123123 | REQWFA | 3|
| 345534 | ASDCA3 | 2|
| 565534 | MCJSL1 | 1|
Is there any way that I can do this in lambda or LINQ? Please help me.