DB2 CASE Statement

Posted by gamerzfuse on Stack Overflow See other posts from Stack Overflow or by gamerzfuse
Published on 2010-04-22T13:14:07Z Indexed on 2010/04/22 13:33 UTC
Read the original article Hit count: 299

Filed under:
|
|

I need to somehow use the CASE syntax (which is beyond me) to affect the database results based on criteria. I have a bunch of royalties in 0.# form (royalty) I have a title ID # (title_id) and I need to show the new increase in royalties so that I can use the data.

IF: they have a current royalty of 0.0 - 0.1 = 10% raise
IF: they have 0.11 - 0.15 = 20% raise
IF: royalty >= 0.16 =  20% raise

Any help would be much appreciated.

    create table royalites (
title_id    char(6),
lorange     integer,
hirange     integer,
royalty     decimal(5,2));

© Stack Overflow or respective owner

Related posts about sql

Related posts about case