I want to take the difference of columns of a table.we have column name as Planned_date so now I Want to take the difference of these two columns
A = Planned_Date of stop1 - Planned_Date of stop5
So how I can write the query to fetch the value of A below is the sample query I have written but somehow it is not working for me.
select (select planned_arrival as val1
from shipment_stop
where stop_num = 1
and shipment_gid = 'IFFCO/LOGISTICS.L171009358')
-
(select planned_arrival as val2
from shipment_stop
where stop_num = 5
and shipment_gid = 'IFFCO/LOGISTICS.L171009358')
Please help.
Your query should work with a
from
clause:Personally, I would write this using conditional aggregation: