ado sql update table with result of group by query

Posted by brett on Stack Overflow See other posts from Stack Overflow or by brett
Published on 2010-05-12T01:29:05Z Indexed on 2010/05/12 1:34 UTC
Read the original article Hit count: 265

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about ado

Related posts about sql