Categories
Mastering Development

Strange query plan on max(date) query on a View

I have a view which comprises 4 yearly tables: USE [BGT] GO /****** Object: View [dbo].[BGT_BETWAYDETAILS] Script Date: 22/5/2020 5:15:40 μμ ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE VIEW [dbo].[BGT_BETWAYDETAILS] WITH SCHEMABINDING AS SELECT * FROM [dbo].[BGT_BETWAYDETAILS_2020] UNION ALL SELECT * FROM [dbo].[BGT_BETWAYDETAILS_2019] UNION ALL SELECT * FROM [dbo].[BGT_BETWAYDETAILS_2018] UNION ALL SELECT […]

Categories
Development

Stored procedure finding products between a range of prices

So I would like the ability to filter a range of prices. So for my filters I have something like this, which just calculates 6 price ranges bases on the min price and max price products. When the tick boxes are checked, the options are passed into the stored procedure. I use this code, which […]