WHERE ((NOT @P1 IS NULL) AND (SearchLike.Search LIKE '%' + @P1 + '%'))
OR ((NOT @P2 IS NULL) AND (SearchLike.Search LIKE '%' + @P2 + '%'))
OR ((NOT @P3 IS NULL) AND (SearchLike.Search LIKE '%' + @P3 + '%'))
Searchlike
, по полю search
.GREATEST( prices1.value, prices2.value )
найти максимальную цену между этими id
SELECT MAX( Value ) FROM Prices WHERE ID BETWEEN ID_1 AND ID_2
А как запрос должен выглядеть для нескольких ID_1 и ID_2
SELECT ID_1, ID_2,
( SELECT MAX( Value ) FROM Prices WHERE ID BETWEEN ID_1 AND ID_2 ) AS PriceMax
FROM Range