Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT description
- FROM l_foods
- WHERE price BETWEEN 1.00 AND 2.00
- ORDER BY description
- SELECT description
- FROM l_foods
- WHERE (price >= (select min_price from sec0306_price_constants )
- AND price <= (select max_price from sec0306_price_constants ))
- ORDER BY description
- declare @constants table (typ varchar(10), minprice float, maxprice float)
- insert into @constants values
- ('dirtcheap', 0.00, 0.99),
- ('justright', 1.00, 2.00),
- ('expensive', 2.01, 10.00)
- select description
- from l_foods f, @constants c
- where f.price >= c.minprice and f.price <= c.maxprice
- and c.typ = 'justright'
- --BEGIN PROC
- DECLARE @MINPRICE DECIMAL;
- DECLARE @MAXPRICE DECIMAL;
- SELECT
- @MINPRICE = min_price,
- @MAXPRICE = max_price
- FROM
- sec0306_price_constants;
- SELECT description
- FROM l_foods
- WHERE
- price BETWEEN @MINPRICE AND @MAXPRICE
- ORDER BY description
Add Comment
Please, Sign In to add comment