我有一张桌子
ITEM_LST
--------
MOD_END
LOW_END
MED_END
HIGH_END
...
JUST_OLD
我使用以下查询并替换列表中的下一个:
INSERT INTO dbo.db_MAIN
SELECT LOW_END, COUNT(*) AS CNT
FROM dbo.todays_db
WHERE LOW_END > ''
GROUP BY LOW_END
ORDER BY LOW_END
如果我使用类似下面的东西,我想循环通过 vals,我是否使用某种循环?
INSERT INTO @db_main
SELECT @item_lst, COUNT(*)
FROM @db_today
WHERE @item_lst > ''
GROUP BY @item_lst
ORDER BY @item_lst