Tpaul_10
asked on
Getting Count(*) into a varibale
Experts,
here is my sample code and have tried multiple options and couldn't get it worked to assign the count(*) to my variable so that I can use that value for later
Declare @@Total
SELECT @Total = count(*) FROM (
SELECT T1.ItemID
FROM MyDatabase..MyTable T1
INNER JOIN
INNER JOIN
INNER JOIN
...
WHERE
GROUP BY T1.ItemID
HAVING
)
Thanks in advance.
here is my sample code and have tried multiple options and couldn't get it worked to assign the count(*) to my variable so that I can use that value for later
Declare @@Total
SELECT @Total = count(*) FROM (
SELECT T1.ItemID
FROM MyDatabase..MyTable T1
INNER JOIN
INNER JOIN
INNER JOIN
...
WHERE
GROUP BY T1.ItemID
HAVING
)
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER