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



Recommended Answers

All 2 Replies

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),...)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.