LibreOffice Base -Queries...

classic Classic list List threaded Threaded
2 messages Options
zed zed
Reply | Threaded
Open this post in threaded view
|

LibreOffice Base -Queries...

I have a database Reactors_Videos and three of the fields are:

No  (Field Type = Number (Numeric)
First (Field Type = Date (DATE)
Last  (Field Type = Date (DATE)

I successfully created a Query to display the total number of Reactions.

This Query takes the form

SELECT SUM( "No" ) FROM "Reactor_Videos Table 1"

I am now trying to create a Query which will display the number of
reactions between any two dates but failing miserably

Most of them return the error : SQL Status: HY000 Error code: 1000
Syntax error in SQL statement" and an internet search reveals that this
error is returned for any number of reasons, none of which are helpful
to me (perhaps because of my lack of knowledge)

My latest attempt was

SELECT SUM( "No" ) FROM "Reactor_Videos Table 1" HAVING ( ( COUNT(
"First" ) = 1 / 12 / 20 AND COUNT( "Last" ) = 31 / 12 / 20 ) )

This saved without any error messages but running the query results in
no output

As will be apparent, my knowledge of the SQL language is minimal at best
and any help members are able to offer will be very welcome.

Zed

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Robert Großkopf Robert Großkopf
Reply | Threaded
Open this post in threaded view
|

Re: LibreOffice Base -Queries...

Hi zed,

you have to set the filter in subquery.
Could be this is what you want to get:

SELECT SUM( "No" ) FROM (SELECT * FROM "Reactor_Videos Table 1" WHERE
"First" >= '2020-12-01' AND "Last" <= '2020-12-31' )

You have to set the dates SQL-like in format 'YYYY-MM-DD'

Regards

Robert
--
Homepage: https://www.familiegrosskopf.de/robert


--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy