记性不好,每次都记不住百度,太浪费时间
分页查询
取前5条数据
select * from table_name limit 0,5
查询第11到第15条数据
select * from table_name limit 10,5
多字段模糊查询
SELECT * FROM student WHERE concat(name,sex,age,classid,zhuanye) LIKE '%2%'
删除为null的字段(判空用is)
delete from table_name where openid is null
select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
神他吗for循环 自己瞎写的
-- 声明变量
declare @i int
declare @max int
declare @str varchar(50)
-- 初始化
set @i=1
set @max = (select count(*) from table_name)
while @i<=@max
begin
set @str =
(
select lpsqId from
-- 给原表添加行标
(select ROW_NUMBER() over(order by bbxrxm) row_num,* from table_name) t
where t.row_num = @i
)
select @str
set @i=@i +1
end
本文由 烦fpy 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: May 16, 2019 at 03:25 pm