"In" Statement Returning 6 Records…overall SQL statement returns 22
I am generating the following SQL statement dynamically with PHP and am having an issue with the records it's returning. The "IN" statement located in the middle with the large list of comma separated values returns 6 records for a particular islandID. However, the final results that are generated when running the entire statement gives me 22 records for the same islandID mentioned above...any help is appreciated. I can provide more info if needed.
SELECT islandID AS parentIslandID, islandName, island.longDesc,
imageLocation, COUNT(resortID) AS totalResorts, resort.resortID
FROM island, images, resort
WHERE parentIslandID = island.islandID
&& parentObjectID = island.islandID
&& imageType = 1
&& island.islandID IN (
SELECT parentIslandID FROM resort WHERE resortID IN (
59,62,65,69,71,72,74,75,76,82,86,89,91,93,95,105,
106,116,117,118,120,121,122,123,124,125,126,127,
131,145,146,150,157,159,160,167,170,174,176,185,188,189,193,
194,198,199,200,203,205,213,217
)
)
&& (search_Inclusive = '-1' || search_Inclusive = '0')
&& (search_onBeach = '-1' || search_onBeach = '0')
&& (search_wedCoord = '-1' || search_wedCoord = '0')
&& (search_roomRate >= '0' && search_roomRate <= '1000')
&& (search_HotelSuite = '-1' || search_VillaCondo = '-1')
&& (passportReq = '-1' || passportReq = '0')
&& (wideAccept = '-1' || wideAccept = '0')
&& (daysSearchable <= '3')
&& (search_airportDist <= '6')
&& resort.active = '-1'
GROUP BY resort.parentIslandID
ORDER BY totalResorts DESC