lets see if i can get this to make any sense at all
i have an application that has a table that holds active visits to our hospital.
i join the "state" table to the visit table to get current diagnoses for the visit.
the state table has multiple states for each visit so as to track what happened at each visit.
my question is..
is there an easy way withing the join syntax to join only the row in the state table with the maximum value for that visit?
something that might look like this..
Code:
.....
inner join state s on v.vID = s.vID AND MAX(s.id)
...
i have been successful doing this with the where clause but i don't think that is an option in this case. I would try and explain how this all fits together but i'm afraid i would fall short of making good sense and everyone would just be lost.
any ideas?
thanks
will