我有以下查询:
SELECT QuoteReference,
CreatedDate,
StartDate,
EndDate,
Operation,
TableName,
OccurredAt,
PerformedBy,
FieldName,
OldValue,
NewValue,
Quotes.CreatedByID,
CompletedDate,
EmailAddress = (SELECT ContactDetails.EmailAddress,
QuoteReference,
ContactDetails.MobilePhoneNumber
FROM ContactDetails,
Quotes,
QuoteCustomers
WHERE ContactDetails.ID = Quotes.ID
AND QuoteCustomers.QuoteID = ContactDetails.ID)
FROM Quotes
JOIN Audit
ON Quotes.ID = Audit.RowId
WHERE Quotes.CreatedDate BETWEEN '20100401' AND '20120830'
AND PaymentReference IS NOT NULL
AND Audit.OccurredAt > Quotes.CompletedDate
AND Quotes.EmailAddress < > NULL
AND TableName = 'Quotes'
AND Quotes.PolicyReference = NULL
AND Quotes.CreatedByID < > 2
ORDER BY Audit.OccurredAt desc
执行时出现此错误:
当不使用 EXISTS 引入子查询时,选择列表中只能指定一个表达式。
在子查询中添加第二个 where 子句后。我能做些什么来解决这个问题?