title: Can a function in mysql return a resultset? If not, what are the possible alternative solutions?
body: <p>I have a view from which I have to select data between 2 given dates (start date and end date).
  The problem is that views in mysql can't accept arguments (as far as I know), and I need to return the result to the calling application.
  In <a href="https://stackoverflow.com/questions/2281890/can-i-create-view-with-parameter-in-mysql">Can I create view with parameter in MySQL?</a> a work around for this by initializing session variable.</p>
  
  <p>My question is: Is it possible to have a function that composes the query from the given arguments and then return the resultset?</p>