I have a stored procedure which has a string parameter. This parameter comes seperated, as '759,760,761'
. In where clause I want to use it like this.
...AND REL.CountyId IN (FIND_IN_SET(REL.CountyId, '759,760,761') > 0)
But there is no returned data however there is row with 759 county id. Datas come if I delete this clause.
Here is my all sql code:
SELECT
REL.RealEstateListingId,
(SELECT
ImageUrl
FROM
realestateimage
WHERE
IsMainImage = 1 AND Status = 1
AND RealEstateListingId = REL.RealEstateListingId) AS ImageUrl,
REL.ListingNumber,
REL.Caption,
REL.M2,
REL.RoomCount,
/*CONCAT((SELECT Name FROM City WHERE CityId IN (SELECT CityId FROM County WHERE CountyId = REL.CountyId)),'/', (SELECT Name FROM County WHERE CountyId = REL.CountyId)) AS Region,*/
REL.Price,
REL.Creation,
REL.CountyId
FROM
realestatelisting AS REL
INNER JOIN
User AS U ON U.UserId = REL.CreatedBy
/*INNER JOIN realestatefilterrelation AS RFR ON RFR.RealEstateId = REL.RealEstateListingId*/
WHERE REL.Price BETWEEN 0 AND 1000000
AND CAST(REL.M2 AS SIGNED) BETWEEN 0 AND 1000
/*AND REL.CountyId IN (FIND_IN_SET(REL.CountyId, '759') > 0)
/*AND RFR.FilterContentId IN(FIND_IN_SET(RFR.FilterContentId, filterIds) > 0)*/
ORDER BY REL.Creation;