SELECT
CountryList.Name,CountryList.Region_name,@_Count=COUNT(*)
FROM [p1].[dbo].[Ips]
INNER JOIN [p1].[dbo].[CountryList] ON [CountryList].ID =[Ips].Country
GROUP BY CountryList.Name,CountryList.Region_name,[Ips].Country
我无法插入@ _Count = COUNT(*) 请帮我 感谢
答案 0 :(得分:0)
DECLARE @Country_List TABLE
(
Name char(3) ,
Region_name nvarchar(50),
_Count int
)
BEGIN TRANSACTION
INSERT INTO @Country_List (Name, Region_name,_Count)
SELECT
CountryList.Name,CountryList.Region_name,COUNT(*)
FROM [Ips]
INNER JOIN [BlackSeo_CountryList] ON [CountryList].ID =[Ips].Country
GROUP BY CountryList.Name,CountryList.Region_name,[Ips].Country
ROLLBACK TRANSACTION
SELECT * FROM @Country_List
This OK