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 |
|
djorre
Yak Posting Veteran
94 Posts |
Posted - 2009-08-01 : 10:53:38
|
| Hi,I could use some help converting a table into a query. We have a system at home that beeps 3 times if the doorbell goes, and beeps one time if someone passes the infrared alarm.I already have a query that converts this analog signals to this form:tblAlarmDoortimestamp---------------value2009-08-03 16:04:10.810 12009-08-03 16:07:45.013 12009-08-03 16:11:03.013 12009-08-03 16:22:20.413 12009-08-03 16:22:21.410 12009-08-03 16:22:22.410 12009-08-03 16:22:33.610 12009-08-03 16:25:45.410 12009-08-03 16:25:46.410 12009-08-03 16:25:47.410 12009-08-03 16:29:39.210 12009-08-03 16:29:40.210 12009-08-03 16:29:41.210 12009-08-03 16:33:51.407 1What I want is to split the doorbell from the ir-alarm, so that I get maybe something like this:timestamp---------------value2009-08-03 16:04:10.810 12009-08-03 16:07:45.013 12009-08-03 16:11:03.013 12009-08-03 16:22:20.413 22009-08-03 16:22:33.610 12009-08-03 16:25:45.410 22009-08-03 16:29:39.210 2 2009-08-03 16:33:51.407 1or, even better:timestamp---------------alarm-doorbell2009-08-03 16:04:10.810 1 02009-08-03 16:07:45.013 1 02009-08-03 16:11:03.013 1 02009-08-03 16:22:20.413 0 12009-08-03 16:22:33.610 1 02009-08-03 16:25:45.410 0 12009-08-03 16:29:39.210 0 1 2009-08-03 16:33:51.407 1 0If anyone has some suggestions or help please let me know!Thanks in advance, Joris |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-08-01 : 11:02:15
|
how far apart will 3 signals for alarm comes in ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
djorre
Yak Posting Veteran
94 Posts |
Posted - 2009-08-01 : 11:07:00
|
quote: Originally posted by khtan how far apart will 3 signals for alarm comes in ? KH[spoiler]Time is always against us[/spoiler]
Normally 1 second, it might differ some milliseconds sometimes but you can use 1 second. |
 |
|
|
djorre
Yak Posting Veteran
94 Posts |
Posted - 2009-08-01 : 17:48:02
|
| I already found a way using joins on s1.time = s2.time + 1 and so ... thanks anyway! |
 |
|
|
|
|
|