THe data I select is not correct

#1

Hello,I use the query to select data, but I find that the result is not correct.
Here is my example, I don’t know why the query do not fifter out the data that delta = 0

SELECT (exchange_ms * 1000 - adjusted_us) as delta FROM “ticks” WHERE delta != 0 and “trading_day” = ‘20170705’ AND “symbol” = ‘ni1709’ order by desc limit 10
name: ticks
time delta


2017-07-05T03:07:58.5Z 0
2017-07-05T03:07:58Z 0
2017-07-05T03:07:57.5Z 0
2017-07-05T03:07:57Z 0
2017-07-05T03:07:56.5Z 0
2017-07-05T03:07:53Z 0
2017-07-05T03:07:52.5Z 0
2017-07-05T03:07:52Z 0
2017-07-05T03:07:51.5Z 0
2017-07-05T03:07:51Z 0

#2

@yqfclid You need to use a subquery to do this:

SELECT delta FROM (SELECT (exchange_ms * 1000 - adjusted_us) as delta FROM "ticks" WHERE and "trading_day" = '20170705' AND "symbol" = 'ni1709') WHERE delta != 0 order by desc LIMIT 10