I am using a MySQL stored function where I have created a function and I have passed column name as a parameter to this function. Suppose
CREATE DEFINER=`ro
After a long search I found that a stored function can be used only to return a single value or a calculated answer (Arithmetic). For your query just use a stored procedure. It is as simple as creating a query from the front end. And here is the syntax:
Use CONCAT(X1,X2,X3 . . .)
to do it as you would like.
CREATE DEFINER=`root`@`localhost` PROCEDURE `Test`(table longtext,column longtext,e_id longtext)
SET @s=CONCAT('Select ',table,' from ', column, 'Where employee = ',e_id);
PREPARE stmt1 FROM @s;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
END