> instances between an ON and OFF),
> SELECT DT, VEHICLEID,NSEW,
> ( SELECT COUNT(NSEW)AS DCT
> FROM INBOUND AS Q1
> WHERE DATEDIFF(DAY,Q0.DT,GETDATE())=7 AND
> Q0.VEHICLEID=137 AND Q0.NSEW = 'IDLE'
> AND Q0.DT >
> ( SELECT MIN(Q2.DT)
> FROM INBOUND AS Q2
> WHERE Q0.DIRECTION = 'IGNITION ON'
> )
> AND Q0.DT <
> ( SELECT MAX(Q3.DT)
> FROM INBOUND AS Q3
> WHERE Q0.DIRECTION = 'IGNITION OFF'
> )
> )
> FROM INBOUND AS Q0
In your sub-selects, the where clause referenxces Q0 from the outer
select... they should probably reference Q2 and Q3. Also... according
to the table info you gave, afaik they should reference Q2.NSEW AND
Q3.NSEW instead of DIRECTION. I don't believe these have to be
sub-selects incidentally, although I don't have time to write out the
alternate syntax at the moment...
> the error message is
> Server: Msg 8114, Level 16, State 5, Line 1
> Error converting data type varchar to float.
at first glance I don't see any attempted conversion from varchar to
float, unless Q0.DIRECTION happens to be a float column. It wasn't
mentioned in the table info.
s. isaac dealey 954.927.5117
new epoch : isn't it time for a change?
add features without fixtures with
the onTap open source framework
http://www.sys-con.com/story/?storyid=44477&DE=1
http://www.sys-con.com/story/?storyid=45569&DE=1
http://www.fusiontap.com
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]