I have an application that groups orders in many different ways (by company, store, warehouse, account). I have used a MS SQL table function to gather the appropriate account IDs and join that table function to my primary order table to make sure the user is exposed to the appropriate orders. This has worked well as it saves me from have to have 20 variations of every select stored proc in the application but I have two questions -
Is this scale-able if the database grows up to 50 million rows in the order table?
Is there a way to do this in MySQL?