读书人

请问一个SQL语句

发布时间: 2012-02-03 22:02:47 作者: rapoo

请教一个SQL语句!
用一条语句从一个表PATHWAY中选出 PATH_ID

分解开来就是

select PATH_ID from pathway where content = 'a'


select PATH_ID from pathway where content = 'b'


找出相同的所有PATH_ID。


[解决办法]
mysql> select t1.p from (select path_id p from pathway where content = 'a') t1, (select path_id p from pathway where content='b') t2 where t1.p = t2.p;
+------+
| p |
+------+
| 2 |
+------+
1 row in set (0.00 sec)

读书人网 >Mysql

热点推荐