我有一個查詢,我正在測試一個'IN'對選擇。操作數應該包含1列在哪裏有
我得到一個「操作數應該包含1列」的錯誤,我認爲是因爲我在'IN'選擇中選擇了多於1列。我需要將第二列作爲我的選擇器的一部分,因爲我需要檢查它是否有'有'語句。
我該如何使這項工作得到我想要的效果?
SELECT DISTINCT c.ID, Title, URLSegment
FROM ListingCategory c
LEFT JOIN SiteTree_Live ON c.ID = SiteTree_Live.ID
JOIN ListingCategory_Listings lc
ON c.ID = lc.ListingCategoryID
WHERE lc.ListingID IN (
SELECT Listing.ID,
(6371 * ACOS(COS(RADIANS(-45.0227996)) * COS(RADIANS(Location.Latitude)) * COS(RADIANS(Location.Longitude) - RADIANS(168.6991149)) + SIN(RADIANS(-45.0227996)) * SIN(RADIANS(Location.Latitude)))) AS distance
FROM Listing
LEFT JOIN Location ON Listing.LocationID = Location.ID
having distance < 5
);
我愛你,想要你的寶寶。謝謝! – Fraser