Compare values in sql 2005 tables in specified timeframe.
Posted on 2011-09-02
I need to compare the values of two tables in sql '05. I have table a and table b. The values in table a are ID, Title, CreatedBy, Created Date, ChangedBy,ChagedDate. The values in table b are the same with the exception of a datetimestamp field. I need to create a query that will return all distinct id's, changedby, and changeddate for all of the records that have been changed in a 24 hour time period.
**For example, Bob logged on and changed the title of a record in table a at 9:12pm on 09/01/11. Table b captures this information and a record is created with the datetimestamp that Bob made the title change. I need to show in the query result set that Bob made this change and the time that he did it as long as it is within a 24-hour time period.
Does anyone have any suggestions on how to get this accomplished?