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
User Profile
Collapse
Profile Sidebar
Collapse
TertiaryKey
Last Activity: Jul 2 '07, 01:37 PM
Joined: May 10 '07
Location: Surrey, UK.
-
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
...Leave a comment:
-
I believe that you should get off the children's carousel - you're much too old!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
...
No activity results to display
Show More
Leave a comment: