Subject | Using Datediff |
---|---|
Author | Craig Cox |
Post date | 2013-06-21T22:35:08Z |
I am using FB 2.5 to query information from three tables, and calculate the number of days from a previous date held in a column and today. Can you provide an example?
This code does not work :(
select
w_containers.container_id,
w_shipments.begin_fill_date,
w_waste_streams.waste_stream,
w_containers.number_of_containers,
datediff(day, (today), w_shipments.begin_fill_date)
from w_shipments
inner join w_waste_streams on (w_shipments.waste_stream_pk = w_waste_streams.waste_streams_pk)
inner join w_containers on (w_shipments.container_pk = w_containers.container_pk)
where
(
(w_shipments.begin_fill_date is not null )
and
(w_shipments.shipping_begin_date is null )
)
order by w_shipments.begin_fill_date
Thanks
This code does not work :(
select
w_containers.container_id,
w_shipments.begin_fill_date,
w_waste_streams.waste_stream,
w_containers.number_of_containers,
datediff(day, (today), w_shipments.begin_fill_date)
from w_shipments
inner join w_waste_streams on (w_shipments.waste_stream_pk = w_waste_streams.waste_streams_pk)
inner join w_containers on (w_shipments.container_pk = w_containers.container_pk)
where
(
(w_shipments.begin_fill_date is not null )
and
(w_shipments.shipping_begin_date is null )
)
order by w_shipments.begin_fill_date
Thanks