0

I am passing string, but in mysql query not executed. because IN not taking integers please check and solve this one.
My query not working

   SELECT * FROM `employee` WHERE  `employee_id` IN 
    (1001,a/bb/001,a/bb/002,a/bb/003,a/bb/004,a/bb/005,a/bb/006,a/bb/007,a/bb/008,a/bb/009,a/bb/010,a/bb/011,a/bb/012) ORDER BY employee_name ASC



correct one is


    SELECT * FROM `employee` WHERE  `employee_id` IN 
    ('1001','a/bb/001','a/bb/002','a/bb/003','a/bb/004','a/bb/005','a/bb/006','a/bb/007','a/bb/008','a/bb/009','a/bb/010','a/bb/011,'a/bb/012') ORDER BY employee_name ASC



how to convert 


    1001,a/bb/001,a/bb/002,a/bb/003,a/bb/004,a/bb/005,a/bb/006,a/bb/007,a/bb/008,a/bb/009,a/bb/010,a/bb/011,a/bb/012 to

    '1001','a/bb/001','a/bb/002','a/bb/003','a/bb/004','a/bb/005','a/bb/006','a/bb/007','a/bb/008','a/bb/009','a/bb/010','a/bb/011,'a/bb/012'

.

3
Contributors
2
Replies
15
Views
1 Year
Discussion Span
Last Post by mblan180131
0

What language are you calling this from? In any case, you should be able to use the cast(val,type) mysql function to do what you want. IE:
IN (cast(1001,varchar),cast(a/bb/001,varchar),...)

Edited by rubberman

0

I have no idea what mySQL is like, and I have no experience with it. However, if you are EVER planning on using JavaScript, you can use the .toString() function, as in:
var fdsa = 1234;
var fdsa2 = fdsa.toString();
var fdsa3 = fdsa2.length;

That kind of thing.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.