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 |
dasmonk
Starting Member
2 Posts |
Posted - 2013-11-12 : 03:57:39
|
I have a table where I´m trying to get some information.Have been succeeding to get the information but it´s slow.Trying to get some other way to do it.Wondering if you have some idea.I want one startdate and one enddate. But I only want them if another tag name has a maximum value of 10 between those date.what I have done now is to write.This code works but not so effecient because it loops through allt the possibility.PLZ help[CODE]for (select ts as st from history where name='tagg1' and value = '1' and ts between t0 and t1 and request='4') doendDate=(select ts as en from history where name='tagg2' and ts between st+25:00 and st+40:00 and request ='4' and value='0');totalsum = (select max from history1 where name='tagg3' and ts between st and endDate )if totalsum = 10 then write st || endDateend;[/CODE] |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-11-12 : 05:06:28
|
this is not Microsoft SQL Server right ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
dasmonk
Starting Member
2 Posts |
Posted - 2013-11-12 : 07:00:11
|
No it´s SQL+ that you using when typing. |
 |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2013-11-12 : 08:35:13
|
Guessing you may want to try an Oracle forum then. This is a Microsoft SQL Server forum. |
 |
|
|
|
|