本文介绍了在SQL中的下一行中移位行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好, 我有一张桌子 -
Hello All, I have a table like -
Name Mobile 1 Sachin 8010023456 2 Kamal 9935463456我们必须像以下一样返回 -
We have to return just like as -
Name Mobile 1 Blank Blank 2 Sachin 8010023456 3 Kamal 9935463456推荐答案
请阅读我的评论。 我不确定你想达到什么,但看看示例: Please, read my comment. I'm not sure what you want to achieve, but have a look at example: SELECT NULL AS [Name], NULL AS [Mobile] UNION ALL SELECT [Name], [Mobile] FROM TableName
如果您只想将第一条记录输出为空白,请尝试此操作。将@t替换为您的表名。 If you just want a output with 1st record as blank try this. Replace @t with your table name. select ROW_NUMBER()over(order by name), name,phone from ( select '' as name,'' as phone union all select name,phone from @t ) p
你应该从表中查询并复制到另一个表并将其命名为 you should query from table and copy to another table and raname it
更多推荐
在SQL中的下一行中移位行
发布评论