gpt4 book ai didi

mysql - 在 MySQL 中选择不同

转载 作者:行者123 更新时间:2023-11-29 21:21:15 25 4
gpt4 key购买 nike

如何返回 AccountDescription 的唯一记录?我知道如何使用 distinct 但我不确定如何在这种情况下应用它。

    SELECT
Contacts.FirstName,
Contacts.LastName,
Account.AccountType,
Account.AccountDescription
FROM Contacts
INNER JOIN Account
ON Contacts.UserID = Account.AccountID
WHERE UserAccountType LIKE '%TEST%'
AND AccountType = 'trial'

我基本上需要获取所有唯一的 AccountDescription,因为有许多联系人具有相同的 AccountDescription

我目前返回的内容:

AccountType : Trial , AccountDescription : test1
AccountType : Trial , AccountDescription : test2
AccountType : Trial , AccountDescription : test1

我需要获取唯一的AccountDescription

最佳答案

我自己使用GROUP BY AccountDescription;解决了这个问题

关于mysql - 在 MySQL 中选择不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35708890/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com