Microsoft
Software
Hardware
Network
Question : COUNT_variable Error
I to have tblModellTmp with HP_4 values which represent the Sector for each company. I would like now to count how many companies are in each Sector and then in a second step, save this value for each company in HP_5 so I know for each how many competitors around. But I get already an error in my first line saying the subquery has gave back more then one value
SET @HP_4_Count = (SELECT COUNT(HP_4)FROM tblModellTmp WHERE (T = 1)GROUP BY HP_4)
UPDATE tblModellTmp
SET HP_5 = @HP_4_Count
the simble query
SELECT COUNT(HP_4) AS Expr1, HP_4
FROM tblModellTmp
WHERE (T = 1)
GROUP BY HP_4
gives back
Expr1 HP_4
78 Elektrogeräte & Bauteile
72 Freizeit, Unterhaltung, Hobbies
42 Möbel, Hausrat, Haushaltgeräte
...
Any idea how to solve?
thx
Kongta
Answer : COUNT_variable Error
sorry
UPDATE u
SET HP_5 = x.expr1
from tblmodelltmp as U
inner join (
SELECT COUNT(HP_4) AS Expr1, HP_4
FROM tblModellTmp
WHERE (T = 1)
GROUP BY HP_4
) as x
on u.hp_4=x.hp_4
where u.hp_5 <> x.expr1
Random Solutions
Server Side Includes folder not in the right place?
How to find max/min integers in a vector?
Windows KMS Clients Activation
Windows 7 - maximize all windows ?
Cisco VLAN
differences between windows server 2003 and windows server 2003 r2
Keyboard Not Working - Again...
XenServer Vs. Hyper V
Move a VM
Best method for automated use of Defrag, chkdsk, Disk cleanup, etc.