Yes. Try using dynamic SQL. Build the SQL statement in a variable any way you like. Then use the PREPARE INTO statement. In this way you can dynamically build a statement with any number of variables, changing WHERE clauses, ORDER, etc. See example code below. -dan
Code
Code
Comment