先定位第二个金字的位置,然后根据这个位置将这个字段分成两段,然后用铜字再将这两部分连接起来.
用LOCATE(substr,str,pos)定位第二个字的位置,
substr截取字符串
concat重新组合
具体的细节自己慢慢实现吧
数据库分页嘛,很简单,看下面的代码分页方案一:(利用Not In和SELECT TOP分页)
语句形式:
SELECT TOP 10 *
FROM TestTable
WHERE (ID NOT IN
(SELECT TOP 20 id
FROM TestTable
ORDER BY id))
ORDER BY ID
--SELECT TOP 20 id FROM TestTable ORDER BY id 查出前20条记录
--查出所有记录中不在前20条记录之外的前10条记录
SELECT TOP 页大小 *
FROM TestTable
WHERE (ID NOT IN
(SELECT TOP 页大小*页数 id
FROM 表
ORDER BY id))
ORDER BY ID
-------------------------------------
分页方案二:(利用ID大于多少和SELECT TOP分页)
语句形式:
SELECT TOP 10 *
FROM TestTable
WHERE (ID >
(SELECT MAX(id)
FROM (SELECT TOP 20 id
FROM TestTable
ORDER BY id) AS T))
ORDER BY ID
--查出所有记录中不在前20条记录的最大值
SELECT TOP 页大小 *
FROM TestTable
WHERE (ID >
(SELECT MAX(id)
FROM (SELECT TOP 页大小*页数 id
FROM 表
ORDER BY id) AS T))
ORDER BY ID
-------------------------------------
分页方案三
select top 50 * from (select top 100 * from sysobjects order by id) as a order by id desc
或者 SELECT TOP PageSize * FROM(SELECT TOP nPage*PageSize * from YOURTABLE )
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)