社区
MS-SQL Server
帖子详情
如何将一条记录分成两条记录呢,在线等待,急!!
handyworkroom
2003-08-30 07:50:59
在下面的一条记录
store表
storedate dining cent1 room cent2
2003-8-29 233.70 2 680.00 3
如何用SQL写,将记录分成两条记录
storedate item money cent
2003-8-29 dining 233.70 2
2003-8-29 room 680.00 3
...全文
51
6
打赏
收藏
如何将一条记录分成两条记录呢,在线等待,急!!
在下面的一条记录 store表 storedate dining cent1 room cent2 2003-8-29 233.70 2 680.00 3 如何用SQL写,将记录分成两条记录 storedate item money cent 2003-8-29 dining 233.70 2 2003-8-29 room 680.00 3
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
lyguo
2003-08-30
打赏
举报
回复
select storedate,item='dining',ding,cent=cent1 from store
union all
select storedate,item='room',ding,cent=cent2 from store
order by storedate
楼上说的不错
zjcxc
元老
2003-08-30
打赏
举报
回复
你可以加个排序语句就行了嘛:
select storedate,item='dining',ding,cent=cent1 from store
union all
select storedate,item='room',ding,cent=cent2 from store
order by storedate
handyworkroom
2003-08-30
打赏
举报
回复
这样写的话,数据就不是按时间排的了,我想让它们有联系的(时间相同的)显示在一前一后,
pinghell
2003-08-30
打赏
举报
回复
这样可以呀
handyworkroom
2003-08-30
打赏
举报
回复
还有别的写法吗?
zjcxc
元老
2003-08-30
打赏
举报
回复
select storedate,item='dining',ding,cent=cent1 from store
union all
select storedate,item='room',ding,cent=cent2 from store
MS-SQL Server
34,576
社区成员
254,588
社区内容
发帖
与我相关
我的任务
MS-SQL Server
MS-SQL Server相关内容讨论专区
复制链接
扫一扫
分享
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章