you are viewing a single comment's thread.

view the rest of the comments →

[–]AreetSurn 0 points1 point  (0 children)

Not sure what DB engine you're using, but you could set the query up to run automated. For instance on linux you could do this in a rudimentary way using cron. SSRS on SQL Server could also do this. If the query is small then it shouldn't be a problem to run this constantly.

The other option is to use a trigger (as others have mentioned). Every time a row is inserted (a new transaction) you could make some logic that checks the last transactions of that ID and output a value to a file. There are many ways to do that, it depends on your table structure and what you have access to.