I'm trying to create a advanced query with sp.
I have in my page 1-8 possible selection (dropdownbox) that a user can make and pass them in to a stored procedure, but the main question is if 2 or more of selection is not made.
Below is a sample that I've recreated from post that I look on a long time ago, I don't know where.
So lets say that a user selects all BOLD values below, but not the Italic+Underlined
Declare @maxprice int = Null
SELECT dbo.LG_dealerCars.carBrand, RTRIM(dbo.LG_dealerCars.carModel) + ' ' + RTRIM(dbo.LG_dealerCars.carModelDescription) AS Model, dbo.LG_dealerCars.carCity
FROM dbo.LG_dealerCars INNER JOIN dbo.LG_dealerCarsPictures ON dbo.LG_dealerCars.carId = dbo.LG_dealerCarsPictures.carId
WHERE (dbo.LG_dealerCars.carBrand = 'Volvo') AND
(dbo.LG_dealerCars.carModel = 'S40') AND
((@maxprice IS NULL) OR (dbo.LG_dealerCars.carPrice >= @maxprice)) AND
(dbo.LG_dealerCars.carPrice <= 200000) AND
(dbo.LG_dealerCars.carCity = 191)
View Complete Post