SELECT * FROM persons;
---- ---------------------
| id | name|
---- ---------------------
| 1 | Antonio Paz |
| 2 | Lilliana Angelovska |
---- ---------------------
SELECT * FROM shirts;
---- --------- -------- -------
| id | style | color | owner |
---- --------- -------- -------
| 1 | polo| blue | 1 |
| 2 | dress | white | 1 |
| 3 | t-shirt | blue | 1 |
| 4 | dress | orange | 2 |
| 5 | polo| red| 2 |
| 6 | dress | blue | 2 |
| 7 | t-shirt | white | 2 |
---- --------- -------- -------
SELECT s.* FROM persons p, shirts s
WHERE p.name LIKE 'Lilliana%'
AND s.owner = p.id
AND s.color <> 'white';
---- ------- -------- -------
| id | style | color | owner |
---- ------- -------- -------
| 4 | dress | orange | 2 |
| 5 | polo | red| 2 |
| 6 | dress | blue | 2 |
---- ------- -------- -------
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




