Help for this page

Select Code to Download


  1. or download this
    create table section (
       sectionId    int
    ...
    ,  price             numeric
    ,  salePrice         numeric NULL
    )
    
  2. or download this
    create table itemPrice (
        itemId      int
    ...
    ,   validFrom   date        NULL
    ,   validTo     date        NULL
    )
    
  3. or download this
    select s.sectionName
         , i.itemId
    ...
        left outer join itemPrice p2 
            on p1.itemId = p2.itemId and p2.type = 1 
           and p2.fromDate < getdate() and p2.toDate > getdate()
    
  4. or download this
                itemId             price                sale_price
     ---------- ------- ---------- -------------------- ------------------
    +--
     section 1        1 item 1                24.990000                 NU
    +LL
     section 1        2 item 2                19.990000            14.9900
    +00