How to clear the 'visible' check box in a query field used only for sorting? [closed]

asked 2017-05-16 08:03:47 +0200

EasyTrieve gravatar image

updated 2017-05-17 04:05:04 +0200

In Base Query Design is there a way to clear the visible box for a field that will only be used to produce the ORDER BY clause? In other words, you don't want that field to be output, but just use it to affect the sort order.

SQL doesn't usually require that fields listed in ORDER BY also be listed in SELECT.

Only if I set the field to (not sorted), can I then un-check this box. But that doesn't make any sense to me. I must be missing something.

image description

For what it's worth, I already tried creating one query to produce all fields, including the sort columns, and then a 2nd query that uses the first query as input, to only select the fields I wanted, and not select the sort fields, but the sort gets messed up in the 2nd query. This reordering shouldn't happen from query to query, but it does.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-10-04 14:01:31.249565


What kind of database do you use? It is possible with the embedded HSQL, but not possible with a flat spreadsheet.

Regina gravatar imageRegina ( 2017-05-17 00:21:18 +0200 )edit

@Regina, sorry, I should have said; I'm connecting to MariaDB via MySQL->JDBC connector. I've known about this issue for some time, but hoped it would just go away at some point once I understood the nature of it.

Also I just did a test w/ HSQLDB 1.8, and can see that it works properly in this regard. I also tried Hide Column in the output, but when I copy the output to Calc, the hidden becomes visible again. Guess it's time to take a walk in the bugzilla garden again. Thanks again.

EasyTrieve gravatar imageEasyTrieve ( 2017-05-17 04:12:10 +0200 )edit

It works fine in SQL View.

Ratslinger gravatar imageRatslinger ( 2017-05-17 04:51:27 +0200 )edit

@Ratslinger, thanks for the workaround. Yes that works great, well almost. It makes it so you can no longer use design mode. For small queries this is fine, for big it's more of a challenge.

Also now I see the little SQL toggle button at the top ('Run SQL Command Directly') which locks design mode off, so the SQL can't be silently destroying by accident. I never new what this button was for till now.

Are you aware of any bug report or fix, for this design mode issue? Thank you.

EasyTrieve gravatar imageEasyTrieve ( 2017-05-17 05:50:41 +0200 )edit

That is not what the button is for. It is to bypass the built-in interpreter. The design view does not allow you to do many of the things you can do with SQL if using other than HSQL 1.8 - it is a crutch.

Ratslinger gravatar imageRatslinger ( 2017-05-17 05:54:23 +0200 )edit

Interesting. You're right, manual says "interpreted" & clarifies w/ "...without a previous evaluation by LibreOffice". So I entered a Union query & with SQL button off, & tried to run it, and got: "Only queries are allowed." which makes no sense, as a UNION query is a query. As far as I can tell, it looks like this "interpretation" is a check to see if the typed SQL is (possibly) compatible with design mode, i.e. a SELECT Q. Thanks for your insight into this.

EasyTrieve gravatar imageEasyTrieve ( 2017-05-17 16:14:08 +0200 )edit

Also noticed column widths changed depending on SQL button state (e.g. for something simple like SELECT * FROM foobar), so something about displayed formatting is also affected by the SQL button.

EasyTrieve gravatar imageEasyTrieve ( 2017-05-17 16:16:19 +0200 )edit

& I was able to get my more complex query to not show columns used only for sorting, so thanks for your tip.

EasyTrieve gravatar imageEasyTrieve ( 2017-05-17 16:18:04 +0200 )edit