插入多行數據時,可以不用寫N多的insert into。
SELECT DISTINCT ' ('+'''' +loginip +''''+') '+',' FROM dbo.Login
WHERE loginname IN
(
SELECT DISTINCT loginname FROM dbo.Login
WHERE loginip='61.170.245.61'
)
go
--獲得這樣的結果
('61.61.245.243'),
('61.61.245.61'),
這樣直接
insert into testip values
('1.192.47.125'),
('1.58.113.154'),
('1.85.189.111'),
('1.86.37.156'),
('101.84.100.87'),
('106.83.49.191') 效率高點!
查看本欄目