SELECT T1HubOilFlowRate.t_stamp,
T1HubOilFlowRate.T1__FlowRate
WHERE T1_FlowRate > 0
FROM T1HubOilFlowRate
WHERE t_stamp >= :StartDate
AND t_stamp <= :EndDate
ORDER BY t_stamp
I'm trying to eliminate values of 0 from my data. I'm getting an error. Can anyone see what i'm missing?
You have two WHERE
statements, combine it into a single WHERE
after your FROM
statement using AND
and BETWEEN
. Between is inclusive, so it accomplishes the same as
WHERE t_stamp >= :StartDate AND t_stamp <= :EndDate
.
WHERE T1__FlowRate > 0 AND
t_stamp BETWEEN :StartDate AND :EndDate
Edit: Added missing underscore.
@ryan.white I did that but im getting this error now? Not sure how it could be an invalid column name.
SELECT T1HubOilFlowRate.t_stamp,
T1HubOilFlowRate.T1__FlowRate
FROM T1HubOilFlowRate
WHERE T1_FlowRate > 0 AND
t_stamp BETWEEN :StartDate AND :EndDate
ORDER BY t_stamp;
Ah, I quickly glanced at the column name and brain omitted the second _
in T1__FlowRate
when making example code.
You have a single underscore in one column name, and a double underscore in the other.
Edit: Ryan fixed it faster that I could kibbitz.
2 Likes
@pturmel @ryan.white Good catch thank you
@pturmel @ryan.white Gathered some data since the change. I'm still getting some 0's in the dataset. The query seems good. Any idea where these can be coming from?
SELECT T1HubOilFlowRate.t_stamp,
T1HubOilFlowRate.T1_FlowRate
FROM T1HubOilFlowRate
WHERE T1_FlowRate > 0 AND
t_stamp BETWEEN :StartDate AND :EndDate
ORDER BY t_stamp;
Some extremely small value that is near zero and being rendered as a 0 because of rounding?
3 Likes
Are you sure these are not truncated values?
Maybe try WHERE T1_FlowRate > 0.01 AND
3 Likes
@David_Stone @ryan.white Let me try changing it to >.01. Thanks.