ado sql update table with result of group by query
- by brett
I am trying to update records in an .mdb table with the number of records containing the same value
The sql below does not work but I think gives an indication of what I am trying to achieve.
UPDATE table1 AS A
INNER JOIN (SELECT PH_BSP , Count(PH_BSP) AS PHCOUNT FROM table1 GROUP BY PH_BSP) AS B
ON A.PH_BSP=B.PH_BSP
SET A.PH_SORT = B.PHCOUNT;
any ideas?