How to switch queries in a select statement using filtering

I had a situation where I needed to change a SQL query altogether based on a parameter. So tried nulling and then using COALESCE, IIF and CASE but they didn’t work all, I came up with a rather inefficient solution. It’s inefficient but I can scale it for my small queries. The only quirk is… Continue reading How to switch queries in a select statement using filtering