We won again!

Great victory for the People - Tax Cut!

Home Forums Tech Database Properly format amount field on AS/400 DB2 SQL

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #2342
    VGlushkin
    Participant

    Say you have a numeric field in DB2 database on AS/400 (iSeries).

    You need to divide by 100 to get cents, and you need only 2 decimals after the decimal point:

    SELECT decimal(sum(FWAA/100) ,13,2), count(*) FROM PDDTA/F5665
    where FWDCT<>'JR' and FWCO<>'00990'

    The output will look like this:

    DECIMAL                COUNT ( * )
    68,542,527.90 5,487

    Your users will be happy for a while.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.