Ask Your Question
0

DATEDIF to Calculate Difference of two Date Fields in BASE

asked 2016-02-05 23:27:43 +0200

vhdblood gravatar image

I’ve done lots of searching and I’m coming up with no answers, so I turn to you.

I’ve got a table for dates of transplants for plants. I want to have fields that show the difference between these dates automatically when you pull a query.

When I try to do something like this:

SELECT DATEDIF( "MainHarvest"."Clone Date", "MainHarvest"."Solo Date", "y" ) "STUFF" FROM "StrainLink", "MainHarvest"

I get an error message that says:

Access is Denied: DATEDIF in statement….

I’ve tried a million different ways to do this. I tried “DATEDIFF” as well because there’s lots of documentation on it which doesn’t seem to do anything.

So what am I doing wrong? I’m new to LO and Base, as well as new to SQL.

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-02-09 11:32:31 +0200

pierre-yves samyn gravatar image

Hi

Syntax DATEDIFF ( <field>, <datetime value expr 1>, <datetime value expr 2> )

  • Use " around Fields names
  • Use ' around keywords

So something like:

SELECT DATEDIFF('dd', "Clone Date", "Sole Date" ) "STUFF" FROM "MainHarvest"

Regards

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-02-05 23:27:43 +0200

Seen: 1,462 times

Last updated: Feb 09 '16