我有一个查询,我正在针对选择测试“IN”。
我收到“操作数应包含 1 列”错误,我认为这是因为我在“输入”选择中选择了超过 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
);