Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
eddy556
Starting Member
36 Posts |
Posted - 2009-01-12 : 09:25:06
|
| I have a trigger which automatically timestamps a record when it has changed.I now need a stored procedure which will somehow 'loop' through all records/tables relating to a certain Material and if a timestamp has been found within a certain length (such as day) in any of the records it will return the MTRLCODE for the Material.In essence I need the SQL which can return all records from any related table and return all the MTRLCODEs for any Materials with any records within 24hours of the date stamp.Many thanks! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-12 : 09:28:45
|
| [code]SELECT *FROM YourTable t1JOIN table2 t2ON.........WHERE timestamp>DATEADD(hh,-24,GETDATE())[/code] |
 |
|
|
|
|
|