Sample Header Ad - 728x90

why does the order of fields return 0 rows, but move the field does

0 votes
1 answer
32 views
I have two queries that return the same data, only the calculating field with the case is moved. I am using the Access Client Solutions "run query" to execute the query. If I run this one
Select storenum,
       businessdate,
       kitchensenttime,
       parkcartime as delivertime,
       (parkcartime-kitchensenttime) as deliveryseconds,
       case
           when parkcartime-kitchensenttime>360 then 1
           else 0
       end as disastrouscount
from irislib.tblorder
where not(kitchensenttime='01/01/0001'
          or parkcartime='01/01/0001')
    and parkcartime>kitchensenttime
    and businessdate='05/18/2022'
No rows are returned. While this one
Select storenum,
       businessdate,
       kitchensenttime,
       case
           when parkcartime-kitchensenttime>360 then 1
           else 0
       end as disastrouscount,
       parkcartime as delivertime,
       (parkcartime-kitchensenttime) as deliveryseconds
from irislib.tblorder
where not(kitchensenttime='01/01/0001'
          or parkcartime='01/01/0001')
    and parkcartime>kitchensenttime
    and businessdate='05/18/2022'
Will return rows. If I try the "broken" query with just the storenum and businessdate with just the disastrouscount calculation will it return rows.
Asked by Paul (1 rep)
May 19, 2022, 03:47 PM
Last activity: May 20, 2022, 02:25 PM