mysql查询多次重复相同的结果数据行

时间:2015-01-15 05:59:10

标签: mysql

我写了一个查询,它给了我想要的输出,但它重复输出几次,结果它影响了前端。任何人都建议一种改进它的方法。

查询如下:

SELECT 
  * 
FROM
  crm_support_inquiry 
  INNER JOIN crm_inquiry_perticipant 
    ON crm_support_inquiry.inquiry_id = ? id 
  INNER JOIN crm_mailer_types 
    ON crm_support_inquiry.mailer_id = crm_mailer_types.mailer_id 

结果是: enter image description here

我们要做出哪些更改,以便只获得与提供的ID相对应的一家公司的输出。对crm_perticipant_inquiry中的所有公司重复mailertype和sent_on。

2 个答案:

答案 0 :(得分:0)

在查询中使用'distinct'关键字,因此您不会获得重复值

答案 1 :(得分:0)

我建议您在查询中使用列名,然后选择使用distinct。

不同的column1,column2,column3

相关问题