1樓:匿名使用者
select * from table1 union all select * from table2,union all 是所有的bai都顯示出來
du,union 是隻顯示不重zhi復的,如果兩個表的
dao欄位部分相同,把查詢的版欄位寫出來亦權可
2樓:匿名使用者
用union關鍵來字就可
以,你自試一下。
select t1.id,t1.name,t1.
***,t1.state from talbe1 as t1 union select t2.id,t2.
name,t2.***,t2.state from talbe2 as t2。
如果想把相同的資料都顯示出來將union 換成union all即可
3樓:匿名使用者
或許你說的是用下面的語句:
select * from table1 union all select * from table2
如何用sql語句查詢兩張表中的相同欄位資料
4樓:千鋒教育
假設表1位table1 ,表2位table2select a.col
from (select column_name col from user_tab_columns where table_name = 'table1') a ,
(select column_name col from user_tab_columns where table_name = 'table2') b
where a.col = b.col
這樣就可以查詢出兩個表得相同欄位了
sql怎麼將2張表查詢出來的相同欄位合併顯示在一個欄位中.
5樓:徐磊
條件:a表有a.1,a.2,a.3,c四個欄位;b表有b.1,b.2,b.3,c四個欄位。
要求:sql將2張表查詢出來的相同欄位合併顯示在一專個屬欄位中.
答案:select a.* from a as a,b.* from b as b where a.c=b.c
6樓:匿名使用者
你的關聯條件不變
取得的時候稍微處理一下
sqlserver :
isnull ( b.產品型別,c.產品型別)isnull ( b.產品規
回格,c.產品規格)
isnull ( b.產品標準答,c.產品標準)oracle:
把isnull 換成nvl 就好了
如何用sql 語句將兩個資料表相同欄位合併成另外一個表
7樓:匿名使用者
select a,b,c from tb1
union (all)
8樓:匿名使用者
select * into tb3 from (select a,b,c,d,e from tb1union all select a,b,c,d,e from tb2 ) tbx
9樓:匿名使用者
create table x as (select a.field,b.field from a,b where a.id = b.id)
10樓:孝悅位溪兒
select
a,b,c
from
aunion
allselect
a,b,c
from
b以上,希望對你有所幫助!
sql查詢語句怎麼寫,sql彙總查詢的語句怎麼寫啊
如果表裡只是那幾列資料的話 select a.欄位名,b.欄位名 from 表 as a left join 表 as b on a.substring 欄位名,7,2 b.substring 欄位名,7,2 where a.欄位名 like 201008 and b.欄位名 like 201009...
sql查詢語句
你寫的就已經是對的了啊。你還要問什麼呢?select a.b.from a b where a.id b.id 就這個啊。從a,b表取全部的資料,他們的id是關聯條件。比如a表 暫且定為學生表 b表,為成績表。一個學生id對應一個或多個成績。所以關聯條件是學生id。當然。在b表中必定存有學生id。不...
sql查詢語句的特殊符號,SQL查詢語句的特殊符號
這是最基本的查詢語句,就是從 product 表查詢 id product name product images 這4個欄位,條件是 product images 不等於空,查詢結果按照 product order id 的升序排列 從product表中查詢符合product images這個欄位...