Results 1 to 2 of 2

Thread: Please help!

  1. #1
    Join Date
    Oct 2003
    Posts
    1

    Exclamation Unanswered: Please help!

    Okay, I'm working on a small retail book store database and I need to view some revised prices. I THINK I should be using the DECODE function as shown below in my desperate attempt to complete this task. If not, a little push in the right direction would be MUCH appreciated!

    SELECT title, category, retail "current retail price"
    FROM books
    DECODE(category, "computer", retail*.90,
    "fitness", retail*.85,
    "self help", retail*.75,
    retail*.97) "revised retail price";

    I get an error everytime! I even tried having "FROM books" at the end.. that didn't work either! I'm so confused! PLEASE give me a hint as to how I can correct this...

    I need to take the current retail price (retail) and according to the books category, issue a discount. I need to display the book title (title), the book's category (category), current retail price (retail) and revised retail price. Category discounts: computer = 10%, fitness = 15%, self help = 25%, and all others = 3%.

    Please help me!

    _runaway!
    oOoo
    .o
    Oo
    o.oO
    ___C||_
    c|_O__ O| .oO(CHOO! CHOO!)

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Exclamation

    You need to re-order your SQL like this:

    Code:
    
    SELECT title, category, retail "current retail price",
                DECODE(category, "computer", retail*.90,
                           "fitness", retail*.85,
                           "self help", retail*.75,
                            retail*.97) "revised retail price"
    FROM books;
    
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •