Data related to the query I'm working on is structured such that
TableA and TableB are 1-many(optional). If an item on TableA has
children on TableB, I need to use the Max(tstamp) from Table B in a
condition, otherwise I need to use a tstamp from TableA (note:there
are additional tables and conditions for this query, but this problem
is based around these 2). I attempted having TableB (as B) "left
outer joined" to TableA, and a condition in the query that resembles:
Where B.Tstamp = (select MAX(tstamp) from TableB
where pkey = B.pkey)
However, the obvious problem, is that when B.Tstamp is Null, the
condition fails because the subselect fails. Is there a way I can get
the subselect to return a Null instead of failing, or a cleaner way to
be able to evaluate this condition and still handle when B.Tstamp is
Null and when it is not?
thanks in advance