使用StackOverflow中的SQL JOIN示例What is the difference between "INNER JOIN" and "OUTER JOIN"?
想知道这是否是从Store-procedure返回的,如何从下面的示例中返回不同的值名称和电话号码。即使我创建了一个XML字符串,即使这样我也无法选择DISTINCT值。有什么帮助吗?
select name, phone, selling
from people join property
on people.pid = property.pid;
+-----------+--------------+----------------------+
| name | phone | selling |
+-----------+--------------+----------------------+
| Mr Brown | 01225 708225 | Old House Farm |
| Mr Pullen | 01380 724040 | The Willows |
| Mr Pullen | 01380 724040 | Tall Trees |
| Mr Pullen | 01380 724040 | The Melksham Florist |
+-----------+--------------+----------------------+
答案 0 :(得分:-1)
实际上有点不清楚
但是,如果你喜欢这样的话
Select distinct name,phone
from people join property
on people.pid = property.pid;
Mr Brown | 01225 708225 |
| Mr Pullen | 01380 724040