本文来自 http://blog.csdn.net/wjc19911118/article/details/9716391
Mysql 中联接SQL语句中,ON子句的语法格式为:table1.column_name = table2.column_name。
当模式设计对联接表的列采用了相同的命名样式时,就可以使用 USING 语法来简化 ON 语法,格式为:USING(column_name)。
例如:
[sql] view plain copy
- [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] view plain copy
- [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‘;
时间: 2024-10-11 01:30:06