[Cialug] SQL Question

Kenneth Younger kyounger at gmail.com
Tue Oct 6 15:54:49 CDT 2009


I am having a hard time understanding exactly what you are trying to do, and
it is tough to determine what your tables, columns or relationships are from
the short email. Also what database are you using?

It kinda sounds like you need to use a null test function. In MySQL that
would be ifnull(), in T-SQL that would be isnull(), and PL/SQL would be
nvl().

If you left or right join the tables and to force the one that you're not
sure of to supply a null if it's not supplied, then you can use the above
function to grab either the right date.

I'm more familiar with MS and Oracle DBs, and with those you can use ranking
functions and the over() clause to handle certain instances of trying to
determine most recent with dates. I would bet MySQL has something similar
too, thought it may be overkill for what you need.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cialug.org/pipermail/cialug/attachments/20091006/6b56000e/attachment.htm 


More information about the Cialug mailing list