如何返回Await
的唯一记录?我知道如何使用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
答案 0 :(得分:0)
尝试此查询:
SELECT DISTINCT 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'
答案 1 :(得分:0)
我自己使用GROUP BY AccountDescription;