Ok - in my report I have an SQL Query that almost does what I want it to but not quite. Here's the part of the Query I'm having problems with:
ORDER BY
doc."returned" ASC, doc."drawn" ASC, gen."loan_num" ASC
This works nicely with one exception. When you display something in ascending order, the fields that are blank are displayed first. With doc."returned" (date/time field) I want it to display in ascending order, however I want the blank fields to be displayed last. I'm having trouble coming up with the logic to do this. BTW - it doesn't necesarily have to be in the SQL Query - I just thought that it would best explain my problem. Thanks in advance. :)Don't know what database you're using, but does it have (the equivalent of) NULLS FIRST or NULLS LAST? e.g.
ORDER BY doc."returned" ASC NULLS LAST, doc."drawn" ASC, gen."loan_num" ASC
If you want to do it in the report then maybe you could create a formula based on the date and order the formula instread, e.g.
if isnull({doc.returned}) then cdatetime(3000,1,1,0,0,0)) //or whatever datetime is suitable
else {doc.returned}|||Well I tried the NULLS LAST and it didn't work (I'm not sure what database is being used - SQL Server I believe - but I don't know what version as I don't actually have access to the database itself). I'm going to try the if isnull() statement in the formula however I have a question - is the (3000,1,1,0,0,0,) the only way that cdatatime will accept datetime information?|||No, see the help on CDateTime for other options...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment