mysql - 从存储过程输出 JOINS 的不同值

标签 mysql sql join stored-procedures distinct

使用来自 StackOverflow 的 SQL JOIN 示例,What is the difference between "INNER JOIN" and "OUTER JOIN"?

想知道这是否是从存储过程返回的,如何从下面的示例中返回不同的值名称和电话号码。即使我创建了一个 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 |
+-----------+--------------+----------------------+

最佳答案

其实有点不清楚

但是如果你做一些像 选择不同的名字,电话 从人加入属性(property) 关于 people.pid = property.pid;

你会拥有 布朗先生 | 01225 708225 | |普伦先生 | 01380 724040

关于mysql - 从存储过程输出 JOINS 的不同值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35177382/

相关文章:

mysql - SQL 函数从 5.5 开始非常慢

php - 错误 : SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'contenido' cannot be null

php - 点击php中的提交按钮后无法发送电子邮件

sql - 在一个 SQL 查询中加入两个 COUNT()

mysql - Headi sql : sql error 1054

mysql - SQL - 水平连接两个选择结果

php - 使用字符串mysql更新表

sql - 找不到 postgresql 函数

c# - 插入 Cast 数据和空字段 C# 时出错

mysql - 如何从表中选择并在 MySQL 中使用 LIST RIGHT JOIN