aaronlglover
Technical User
Hey Guys,
I am a complete SQL noob and I have searched all over to figure out how to do this but have nothing. I have two tables; TABLE1(USER_ID, DATE, EXCEPTION, USER_NAME) and TABLE2(USER_ID, MODIFY_DATE, MU_ID). I need to return USER_ID, DATE, EXCEPTION, USER_NAME and MU_ID. The tables are joined on USER_ID. In table 2 there are multiple records for each USER_ID with different MODIFY_DATE (everytime a change is made it made a new record with a new modify date is created.)
I need to basically need to associate the MU_ID that agent had on the date of each particualr record in TABLE1
Here is an example
TABLE1:
USER_ID | DATE | EXCEPTION | USER_NAME
333 | 4/12/09 | BREAK | John Doe
TABLE2:
USER_ID | MODIFY_DATE | MU_ID
333 | 1/1/2009 | 30
333 | 2/24/2009 | 36
333 | 5/23/2009 | 02
333 | 6/17/2009 | 90
Should RETURN
USER_ID | DATE | EXCEPTION | USER_NAME | MU_ID
333 | 4/12/2009 | BREAK | John Doe | 36
Thanks
I am a complete SQL noob and I have searched all over to figure out how to do this but have nothing. I have two tables; TABLE1(USER_ID, DATE, EXCEPTION, USER_NAME) and TABLE2(USER_ID, MODIFY_DATE, MU_ID). I need to return USER_ID, DATE, EXCEPTION, USER_NAME and MU_ID. The tables are joined on USER_ID. In table 2 there are multiple records for each USER_ID with different MODIFY_DATE (everytime a change is made it made a new record with a new modify date is created.)
I need to basically need to associate the MU_ID that agent had on the date of each particualr record in TABLE1
Here is an example
TABLE1:
USER_ID | DATE | EXCEPTION | USER_NAME
333 | 4/12/09 | BREAK | John Doe
TABLE2:
USER_ID | MODIFY_DATE | MU_ID
333 | 1/1/2009 | 30
333 | 2/24/2009 | 36
333 | 5/23/2009 | 02
333 | 6/17/2009 | 90
Should RETURN
USER_ID | DATE | EXCEPTION | USER_NAME | MU_ID
333 | 4/12/2009 | BREAK | John Doe | 36
Thanks