Description: Queries like "SELECT 1 + 1;" refuse to run in Libreoffice Base with the MySQL backend, even tough they run perfectly from the MySQL command line. Not sure if this affects other backends too. The example I provided might not seem very useful, but similar queries are useful for getting ratios such as the percentage of men in a dataset: SELECT (SELECT COUNT(*) FROM members WHERE gender = 'm') / (SELECT COUNT(*) FROM members); This query runs fine from the MySQL command line, but Libreoffice refuses to run it for some reason. Steps to Reproduce: 1. Create database with MySQL as backend. 2. Try running a query like "SELECT 1 + 1;" Actual Results: SQL Status: HY000 Error code: 1000 syntax error /build/libreoffice-fresh/src/libreoffice-7.1.2.2/dbaccess/source/core/api/SingleSelectQueryComposer.cxx: SQL Status: HY000 Error code: 1000 /build/libreoffice-fresh/src/libreoffice-7.1.2.2/dbaccess/source/core/api/SingleSelectQueryComposer.cxx:108 SQL Status: HY000 Error code: 1000 Syntax error in SQL statement /build/libreoffice-fresh/src/libreoffice-7.1.2.2/dbaccess/source/core/api/SingleSelectQueryComposer.cxx:109 Expected Results: It should return the number 2 Reproducible: Always User Profile Reset: No Additional Info: Version: 7.1.2.2 / LibreOffice Community Build ID: 10(Build:2) CPU threads: 4; OS: Linux 5.10; UI render: default; VCL: gtk3 Locale: hu-HU (en_US.utf8); UI: en-US 7.1.2-3 Calc: threaded I am using Manjaro Linux.
No problem here with LO 7.1.3.2 on OpenSUSE 15.2 64bit rpm Linux. Note: You have to choose "Run SQL command directly". The GUI of Base doesn't accept queries without 'FROM "Tablename"'.
Works for me too on Version: 7.1.2.2 / LibreOffice Community Build ID: 8a45595d069ef5570103caea1b71cc9d82b2aae4 CPU threads: 8; OS: Mac OS X 10.16; UI render: default; VCL: osx Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR Calc: threaded cf. enclosed screenshot As Robert has mentioned, you need to run the query in Direct SQL mode, i.e. bypassing the LO SQL parser.
Created attachment 172668 [details] Direct SQL execution from Query GUI
Following comments from Robert and Alex, let's put this one to WFM. Fakjolan: don't hesitate to reopen this tracker if you still reproduce this after having applied advice from them.