I want to calculate a specific subset of data from the 1-minute data source in table M_1. Here are my scripts:
one=select code,dates, iif(deltas(J)>0,1,0) as J_up from (select * , MACD(close, 5, 34, 5) as `DIF`DEA`MACD`J from M_1 where code="000001" order by code,dates)
all=select code,dates, iif(deltas(J)>0,1,0) as J_up from (select * , MACD(close, 5, 34, 5) as `DIF`DEA`MACD`J from M_1 order by code,dates)
Using the order by
clause, I performed two kinds of queries: one retrieves all data and the other filters the data by the stock ID "000001". But the results are different:
I don’t understand why is that. Does anyone can help me?