更新时间:2022-08-16 GMT+08:00

SELECT JOIN Syntax

常用语法

table_references:

table_reference [, table_reference] ...

table_reference:

table_factor | join_table

table_factor:

tbl_name [[AS] alias]
| table_subquery [AS] alias
| ( table_references )

join_table:

table_reference [INNER | CROSS] JOIN table_factor [join_condition]
| table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition
| table_reference [{LEFT|RIGHT} [OUTER]] JOIN table_factor

join_condition:

ON conditional_expr
| USING (column_list)

语法限制

不支持SELECT STRAIGHT_JOIN 和 NATURAL JOIN。

示例

select id,name from test1 where id=1;
select distinct id,name from test1 where id>=1;
select id,name from test1 order by id limit 2 offset 2;
select id,name from test1 order by id limit 2,2;
select  1+1,'test',id,id*1.1,now() from test1 limit 3;
select  current_date,current_timestamp;
select abs(sum(id)) from test1;