User Profile

Collapse

Profile Sidebar

Collapse
TertiaryKey
TertiaryKey
Last Activity: Jul 2 '07, 01:37 PM
Joined: May 10 '07
Location: Surrey, UK.
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • TertiaryKey
    replied to How to use NULLS first
    in DB2
    If you are happy to see a work column in the result table you can replace the null value with a literal for the purpose of ordering. e.g.:-

    Select coalesce(col0,' *NULL') as col0x, tablename.*
    from tablename order by col0x
    See more | Go to post

    Leave a comment:


  • TertiaryKey
    replied to UNION statement
    in DB2
    You should be able to achieve this by replacing the nested column function with a sub-query - maybe something like this:-

    SELECT SUM(T.GROSS)-A.EXPENSE AS INCOME
    FROM EMP A, TEMP T
    WHERE A.EID=T.TID
    GROUP BY A.EXPENSE
    UNION
    SELECT AVG((SELECT SUM(T.GROSS)-A.EXPENSE AS INCOME
    FROM EMP A, TEMP T
    WHERE A.EID=T.TID
    GROUP BY A.EXPENSE )
    ) AS INCOME
    FROM EMP A, TEMP T
    ...
    See more | Go to post

    Leave a comment:


  • TertiaryKey
    replied to You are travelling along......
    I believe that you should get off the children's carousel - you're much too old!
    See more | Go to post

    Leave a comment:


  • SQL unexpected 'null' error from a User Defined Function

    Firstly I would like to say hello to you all as I am a new member.

    I'm calling a User Defined Function 'FormatDate' from DB2 SQL on an AS/400. The UDF receives a CYYMMDD numeric date and returns a DD/MM/YYYY character date. The UDF doesn't allow null parameters so I'm using a Case statement as follows:-

    [PHP]select case when DATEVAL is not null then
    FormatDate(DATE VAL) else 'blank' end
    ...
    See more | Go to post
No activity results to display
Show More
Working...