sql - How do I create a "filter by price" type of query? -


I am using VBScript (ASP Classic) and SQL Server; I am trying to use a segment on the website where you can see the number of products at a fixed price level. Something like this:

  $ 50 - $ 100 (4) $ 100 - $ 500 (198) $ 500 - $ 1000 (43)  

My love I can not understand this is a good way to do a query like this ... I know how to get the number of products at a fixed price range, but I did not know that it was different -How to do on different price limits, write the boat of nested questions to collect all the results without exception, especially when the value Imaan can be very different between the respective products.

Is the rule of thumb "doing something like this when you understand the different price limits?

sum case is

: sum as 50/100 (case when the value > Gt100 = 100 and value> lt; 500) (in case when the price> = 50 and value <100 then 1 and 0 end) <100 500), the amount ( case when value> = 500 and value <1 then 1 and 0 end) The Tpad as 500to1000

The table will only require a scan.


Comments