mysql 中联接sql语句中,on子句的语法格式为:table1.column_name = table2.column_name。
当模式设计对联接表的列采用了相同的命名样式时,就可以使用 using 语法来简化 on 语法,格式为:using(column_name)。
例如:
[sql]
select f.color, c.is_primary, c.is_dark, c.is_rainbow
from flags f www.2cto.com
inner join color c on f.color = c.color
where f.country = 'china';
等价于
[sql]
select f.color, c.is_primary, c.is_dark, c.is_rainbow
from flags f
inner join color c using(color)
where f.country = 'china';
以上就是sql中用join using如何简化join on的实例的详细内容。