Monday 9 September 2013

SQL view with a column that shows top result of relationship with multiple weightings

SQL view with a column that shows top result of relationship with multiple
weightings

I have three tables, an Objects table, a Status table and a StatusTypes
Table.
An Object has Multiple Status' which each has a status type. I would like
to create a view that gives me the objects ID, and Most Important Status
Description which is found in the StatusTypes table, and the most
important status Date which is in the Status Table.
The part I am getting hung up on is to find the most Important Status It
must first be sorted by the latest date, then by a integer weighting
(Priority) in the Status Table then again by another weighting in the
StatusTypes Table (Weighting)
What would be the best SQL statement to quickly deliver these results.

No comments:

Post a Comment