Home  >  Article  >  Database  >  mysql自联结

mysql自联结

WBOY
WBOYOriginal
2016-06-07 16:37:361328browse

mysql的 自联结 的处理速度比子查询快了很多。所以自联结还是有必要学习的。 普通的s ql子查询语句 SELECT `id`,`bic` FROM `biao` WHERE `id`=(SELECT `id` FROM `biao` WHERE `id`='9696e'); mysql的自联结sql语句 SELECT `id`,`bic` FROM `biao` AS a, `b

mysql的自联结的处理速度比子查询快了很多。所以自联结还是有必要学习的。
普通的sql子查询语句

SELECT `id`,`bic` FROM `biao` WHERE `id`=(SELECT `id` FROM `biao` WHERE `id`='9696e');

mysql的自联结sql语句

SELECT `id`,`bic` FROM `biao` AS a, `biao` AS b WHERE a.id=b.id AND b.id='9696e';

自联结的sql语句看起来也清爽优美。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn