1. 程式人生 > >mysql操作--連接查詢

mysql操作--連接查詢

code select lec col tab pre 左連接 查詢 from

1.innerjoin(內連接,或等值連接)

select * from table1 inner join table2 on table1.column1= table2.column2;

2.left join(左連接)

select * from table1left join table2 on table1.column1= table2.column2;

3.right join(右連接)

select * from table1 right join table2 on table1.column1= table2.column2;

4.select並集

select * from table1left join table2 on table1.column1= table2.column2 union select * from table1 right join table2 on table1.column1= table2.column2;

mysql操作--連接查詢