select id, faultcode,createTime from faultdaily inner join
(select id, faultcode,createTime from faultdaily where faultcode<>'6A55') on(ABS(timediff(select date_sub(createTime,interval 5 second )
from faultdaily where faultcode='6A55',select date_sub(createTime,interval -5 second ) from faultdaily where faultcode='6A55'))<5)
该怎么改啊?
(select id, faultcode,createTime from faultdaily where faultcode<>'6A55') on(ABS(timediff(select date_sub(createTime,interval 5 second )
from faultdaily where faultcode='6A55',select date_sub(createTime,interval -5 second ) from faultdaily where faultcode='6A55'))<5)
该怎么改啊?
SELECT id, faultcode,createTime FROM faultdaily INNER JOIN
(SELECT id, faultcode,createTime FROM faultdaily WHERE faultcode<>'6A55') a
WHERE
(ABS(TIMEDIFF(
(SELECT DATE_SUB(createTime,INTERVAL 5 SECOND )
FROM faultdaily WHERE faultcode='6A55'),(SELECT DATE_SUB(createTime,INTERVAL -5 SECOND ) FROM faultdaily WHERE faultcode='6A55')
))<5);
(select id, faultcode,createTime from faultdaily where faultcode<>'6A55') t on(ABS(timediff(select date_sub(createTime,interval 5 second )
from faultdaily where faultcode='6A55',select date_sub(createTime,interval -5 second ) from faultdaily where faultcode='6A55'))<5)