SQL question
I have a query I am trying to do in SQL, but I don't know how to do it.
I have 4 tables (T1, T2, T3, T4) and I need to link them all togethr and get the max of a couple of fields.
Here basic descirption of what I need to do
T1 has the name of the data
T2 is used to link T1 to T3
T3 has 2 sets of dates, I need the min of one and the max of the other
T4 has a status, which is either 'RED', 'Green', 'Yellow'
Now I have T1, T2, and T3 linking properly so the min and max of the dates is getting displayed.
Sample output
Data MaxDate MinDate
D1 1/1/2007 1/1/2003
Now I need help linking T1 to T4 and having it pull the colour that I need. If any record has red I want red to show up, if any record has Yellow and not red then yellow is shown, if only green is there I want green to show up, and if no records I want it to be blank.
|