I would like to write a mysql function that takes an integer as input and that function execute a select statements “select id from table_name” then i want that function return the result of select statements.
then
in query i want to do smthing like:
select id,name from table_name where id in (call function here that returns a list of ids).
Is that valid in mysql ??
Thanks in Advance
No, you cannot do this in
MySQL.A
MySQLprocedure that returns a resultset cannot be used in a subquery.If your function is just a number of
SELECTstatements, you can do something like this instead:or, which is more efficient,