Need some assistance with this. The expresion below runs fine as is, but I'm getting the above listed error whenever I change line 5 from:
and e.timestampnbr >= a.timestampnbr),
TO
and e.timestampnbr >= a.timestampnbr + 2 and e.timestampnbr < a.timestampnbr + 5),
Trying to mimic line 3, but it keeps failling out. Any thoughts?
----
1: ifnull((select top 1 c.time from timestmp c where a.date = c.date
2: and a.wrkordnbr = c.wrkordnbr and c.status in (60)
3: and c.timestampnbr >= a.timestampnbr + 2 and c.timestampnbr < a.timestampnbr + 5),
4: ifnull((select top 1 e.time from timestmp e where a.date = e.date
5: and a.wrkordnbr = e.wrkordnbr and e.status in (102)
6: and e.timestampnbr >= a.timestampnbr),
7: (select top 1 f.time from timestmp f where a.date = f.date
8: and a.wrkordnbr = f.wrkordnbr and f.status in (70)
9: and f.timestampnbr >= a.timestampnbr)
10: )) as Exp1
and e.timestampnbr >= a.timestampnbr),
TO
and e.timestampnbr >= a.timestampnbr + 2 and e.timestampnbr < a.timestampnbr + 5),
Trying to mimic line 3, but it keeps failling out. Any thoughts?
----
1: ifnull((select top 1 c.time from timestmp c where a.date = c.date
2: and a.wrkordnbr = c.wrkordnbr and c.status in (60)
3: and c.timestampnbr >= a.timestampnbr + 2 and c.timestampnbr < a.timestampnbr + 5),
4: ifnull((select top 1 e.time from timestmp e where a.date = e.date
5: and a.wrkordnbr = e.wrkordnbr and e.status in (102)
6: and e.timestampnbr >= a.timestampnbr),
7: (select top 1 f.time from timestmp f where a.date = f.date
8: and a.wrkordnbr = f.wrkordnbr and f.status in (70)
9: and f.timestampnbr >= a.timestampnbr)
10: )) as Exp1