14 个解决方案
#1
用union
必须保证前后字段名称。数目。数据类型一致
select rid as id,rcontents as contents,rtime as time from reply
union
select rrid as id,rcontents as contents,rrtime as time from reverts
必须保证前后字段名称。数目。数据类型一致
select rid as id,rcontents as contents,rtime as time from reply
union
select rrid as id,rcontents as contents,rrtime as time from reverts
#2
已经给你写出来了
#3
不用放在一个新表中么?因为我要用数据绑定控件绑定这些字段。
#4
已经用sql合并成新表里
#5
用union
必须保证前后字段名称。数目。数据类型一致
select rid as id,rcontents as contents,rtime as time from reply
union all
select rrid as id,rcontents as contents,rrtime as time from reverts
必须保证前后字段名称。数目。数据类型一致
select rid as id,rcontents as contents,rtime as time from reply
union all
select rrid as id,rcontents as contents,rrtime as time from reverts
#6
因为这个新表我要和其他的表合起来进行查询,所以是不是要给这个表一个名字,我好方便查询。。。查询后我还要绑定在控件中显示出来的。。
#7
那给这个新表一个新的名字应该怎么写呢,就是把读到的数据放在一个表里面去。。。
#8
不明白你说的。
如果你是用adapter的话 adapter.Fill(mydataset)
mydataset.datatable[0]就是你要找的表。直接绑定数据控件就行了
如果你是用adapter的话 adapter.Fill(mydataset)
mydataset.datatable[0]就是你要找的表。直接绑定数据控件就行了
#9
select rid as id,rcontents as contents,rtime as time from reply
union all
select rrid as id,rcontents as contents,rrtime as time from reverts
把他当做一个sql,查询数据库,得到一个datatable,然后绑定到控件上就行了。不用给名字。
#10
+1
用 union all
#11
不好意思哈,我是说我绑定数据控件的时候还要把这个合成的新表和数据库中的其他表连接查询。。
#12
建个视图不就好了
#13
union all
#14
楼主要这样?
select * from
(select rid as id,rcontents as contents,rtime as time from reply
union all
select rrid as id,rcontents as contents,rrtime as time from reverts) as t
#1
用union
必须保证前后字段名称。数目。数据类型一致
select rid as id,rcontents as contents,rtime as time from reply
union
select rrid as id,rcontents as contents,rrtime as time from reverts
必须保证前后字段名称。数目。数据类型一致
select rid as id,rcontents as contents,rtime as time from reply
union
select rrid as id,rcontents as contents,rrtime as time from reverts
#2
已经给你写出来了
#3
不用放在一个新表中么?因为我要用数据绑定控件绑定这些字段。
#4
已经用sql合并成新表里
#5
用union
必须保证前后字段名称。数目。数据类型一致
select rid as id,rcontents as contents,rtime as time from reply
union all
select rrid as id,rcontents as contents,rrtime as time from reverts
必须保证前后字段名称。数目。数据类型一致
select rid as id,rcontents as contents,rtime as time from reply
union all
select rrid as id,rcontents as contents,rrtime as time from reverts
#6
因为这个新表我要和其他的表合起来进行查询,所以是不是要给这个表一个名字,我好方便查询。。。查询后我还要绑定在控件中显示出来的。。
#7
那给这个新表一个新的名字应该怎么写呢,就是把读到的数据放在一个表里面去。。。
#8
不明白你说的。
如果你是用adapter的话 adapter.Fill(mydataset)
mydataset.datatable[0]就是你要找的表。直接绑定数据控件就行了
如果你是用adapter的话 adapter.Fill(mydataset)
mydataset.datatable[0]就是你要找的表。直接绑定数据控件就行了
#9
select rid as id,rcontents as contents,rtime as time from reply
union all
select rrid as id,rcontents as contents,rrtime as time from reverts
把他当做一个sql,查询数据库,得到一个datatable,然后绑定到控件上就行了。不用给名字。
#10
+1
用 union all
#11
不好意思哈,我是说我绑定数据控件的时候还要把这个合成的新表和数据库中的其他表连接查询。。
#12
建个视图不就好了
#13
union all
#14
楼主要这样?
select * from
(select rid as id,rcontents as contents,rtime as time from reply
union all
select rrid as id,rcontents as contents,rrtime as time from reverts) as t