create table lhcb as
select '123' user_id, '200812' adate, '1'flag from dual
union all
select '123' user_id, '200912' adate, '0'flag from dual
union all
select '123' user_id, '201012' adate, '1'flag from dual
union all
select '121' user_id, '200812' adate, '1'flag from dual
union all
select '121' user_id, '200912' adate, '0'flag from dual
union all
select '121' user_id, '201012' adate, '0'flag from dual
写这样的sql语句就可以搞定:
[img]http://dl.iteye.com/upload/attachment/383488/4e7103db-2903-35a4-a81d-920b059c9b6a.jpg[/img]
如果是这样的sql,还会有六条记录
[img]http://dl.iteye.com/upload/attachment/383492/5e83842b-3896-3606-98e9-f81d94c5ddf0.jpg[/img]
SQL构造示例
本文提供了一个使用SQL语句创建表格并填充数据的具体示例。通过UNION ALL操作演示了如何生成重复的记录。
702

被折叠的 条评论
为什么被折叠?



