Where do you declare "today"? This is an example: select datediff( day, (select current_date from rdb$database), (select current_date-10 from rdb$database)) from rdb$database gives an answer of -10 so if you substitute this code:
> datediff(day, (select current_date from rdb$database), w_shipments.begin_fill_date) that will work if you have no other errors. Regards Alan Alan J Davies Aldis On 21/06/2013 23:35, Craig Cox wrote: > 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 > > ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
