How to create table or maybe trigger that doing like this below?
Date Data
2/6/2013 2
2/6/2013 1
2/6/2013 3
2/6/2013 1
2/6/2013 0
The table at top will alternately as input for next table below, but only the last input will show at table below. The input will alternately from 2 until 0
Just say the input start from 2 – 1 – 3 – 1 – 0, and only 0 will show on table.
How to make the trigger? 0 only data, not something unique. Only the latest input will show on table. Remember the table below triggered table at top to take the data.
I just want every time new input inserted, the data that already existed delete and only the new input will show
Data
0
I think you just want a VIEW that shows the latest value.
The following would be the query you’d use for your view…
EDIT To do exactly what you want you’d just need a stored procedure for inserting.
Now Table will contain only 1 row with the latest value, while History will contain all the old values. This is completely non-standard and irrational, but should be exactly what you want. If you don’t need history you can just remove the first INSERT statement.