Hello,
Can someone please help me with the following script?
SELECT DISTINCT RegNumber FROM tblPools WHERE (NOT (RegNumber IS NULL))
FOR EACH RegNumber
SELECT poolNumber, COUNT(DISTINCT players) AS numPlayers
FROM R_#RegNumber#
GROUP BY poolNumber
HAVING (poolNumber IN (SELECT DISTINCT poolNumber FROM R_#RegNumber#))
ORDER BY poolNumber
FOR EACH poolNumber
UPDATE tblPools SET TotalPlayers = R_#RegNumber#.numPlayers WHERE (poolNum = R_#RegNumber#.poolNumber)
Table R_#RegNumber#: #RegNumber# corresponds to the RegNumber retrieved from tblPools at top query.
How can I use joints to accomplish this script? I think I could use cursors for looping "FOR EACH RegNumber", and update in "FOR EACH poolNumber". But I think using joint for this script will save lots of server's load.
Thanks
Can someone please help me with the following script?
SELECT DISTINCT RegNumber FROM tblPools WHERE (NOT (RegNumber IS NULL))
FOR EACH RegNumber
SELECT poolNumber, COUNT(DISTINCT players) AS numPlayers
FROM R_#RegNumber#
GROUP BY poolNumber
HAVING (poolNumber IN (SELECT DISTINCT poolNumber FROM R_#RegNumber#))
ORDER BY poolNumber
FOR EACH poolNumber
UPDATE tblPools SET TotalPlayers = R_#RegNumber#.numPlayers WHERE (poolNum = R_#RegNumber#.poolNumber)
Table R_#RegNumber#: #RegNumber# corresponds to the RegNumber retrieved from tblPools at top query.
How can I use joints to accomplish this script? I think I could use cursors for looping "FOR EACH RegNumber", and update in "FOR EACH poolNumber". But I think using joint for this script will save lots of server's load.
Thanks