union這個(gè)連接是有什么用的和INNER JOIN有什么區(qū)別
Inner join 是兩張表做交連后里面條件相同的部分記錄產(chǎn)生一個(gè)記錄集,
union是產(chǎn)生的兩個(gè)記錄集(字段要一樣的)并在一起,成為一個(gè)新的記錄集
Select A.Field1,B.field2 from Table1 A inner join Table2 B on a.Field2=b.Field2 where ……….
Select Field1 from Table1 union Select Field2 from table2
方案二、
select a.id,a.title,b.content from 表格1 as a,表格2 as b where a.id=b.id order by a.id
rs(“id”)
rs(“title”)
rs(“content”) 另:
新建一個(gè)表xxx
sql=”insert into xxx select P.id,P.title,M.content from picture P inner join miaoshu M on P.id=M.id”
conn.execute sql
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載。
THE END