Search code examples
vb.netwinformsms-accessdatagridvba

Populate datagrid from two tables (VB.NET / Access)


I have Access database and I'm using VB.NET. DB has two tables

  1. Technicians
  2. Faults

I have columns I want from technicians table in datagrid, but I want to have extra column which should show how many faults every technician fixed based on the Faults table(so I think query will need to run for every row). Is this even possible?

Big Thank you for any help


Solution

  • That should be

    SELECT technicians.techname, count(*) AS NoOfFaults
    FROM technicians
    LEFT JOIN faults ON technicians.ID = faults.TechnicianID
    GROUP BY technicians.techname;