私は次のクエリを持っています:
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でサブクエリが導入されていない場合、選択リストで指定できる式は1つだけです。
サブクエリに2番目のwhere句を追加した後。これを修正するにはどうすればよいですか?