MySQL Forums
Forum List  »  Newbie

Re: In query not working
Posted by: Byron Platt
Date: July 30, 2009 06:55AM

This feels a bit dodgy to me. I'm guessing the csv variable is actually being passed in and isn't a constant. I'm also guessing your foreignKeyId field is an integer which means you a comparing text with an integer which is not good practice. All that said the following should work:
DECLARE csv VARCHAR(255);
SET csv = '268,484,435';
SELECT *
FROM tableX
WHERE FIND_IN_SET(foreignKeyId, csv) != 0;

Options: ReplyQuote


Subject
Written By
Posted
July 30, 2009 06:00AM
July 30, 2009 06:06AM
Re: In query not working
July 30, 2009 06:55AM
July 30, 2009 07:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.