我有一张表
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
如果我想循环使用val,如果我使用类似下面的内容,我会使用某种循环吗?
INSERT INTO @db_main
SELECT @item_lst, COUNT(*)
FROM @db_today
WHERE @item_lst > ''
GROUP BY @item_lst
ORDER BY @item_lst