SELECT a."id" a."Name", max(b."Module_Num") as "Num" FROM project."Power" a LEFT JOIN project."View_All_BD" b on (a."Device_dest" = b."XM_Name") GROUP by a."id" ORDE...