[Base] SQL LIMIT doesn't work in a Table Control

I have a problem with showing only N records in Table Control nested in a Form. Query is simple:
SELECT “attributes”.“attribute”, “tags_map”.“id_tag” FROM “tags_map”, “attributes” WHERE “tags_map”.“id_attr” = “attributes”.“id_attr” LIMIT 5
and it works well in a Design View (showing only 5 records) but when I use it in SQL Command in Content field and pass to the form “id_tag” the Table Control shows all matching records and not as requested 5.
Have anybody come across something like this? Can you help?


OK, thanks. I attach recreated base file where problem still exists.
In ServiceForm the problem exists in “Attributes Form by Tags” the query: SELECT “attributes”.“attr”, “attributes”.“id_obj”, “tags_map”.“id_tag” FROM “tags_map”, “attributes” WHERE “tags_map”.“id_attr” = “attributes”.“id_attr” LIMIT 5

shows in “Attributes Table Control” all records not only 5

Additional question: How to enable showing all services and tags in Objects Table Control when nothing selected in filters (_id_srv, _id_tag) ?

Have just tested with a simple Select statement using Mint 18.3, LO v6.2.3.2 and HSQLDB (you have provided no relevant information). Had no problems. Please present your relevant information and a sample with the problem.

I updated my post with sample file


Have attached a sample. Just a search form. Type in read or horror then press button to get result. Will return 2 records although each has three available - can change Query. Form frm_Search gets data from query. Form frm_Search1 uses the SQL Command in Content field as stated in your question. Not sure what you mean by passing “id_tag”.

Sample — BookSearch.odb

Edit 2019-05-14:

There are multiple problems present. First is your actual question. It was not clear at all that this situation was on a sub sub form. Also you are mixing linking forms with SQL commands for data source - use one or the other.

Don’t really understand just what it is you are doing. The tables themselves don’t make any sense. Did fix the problem. Removed the links and added them to the SQL.

Sample #2 ------ SQLlimitWorking.odb

As for the extra question, you just need to add an OR condition in the Where portion. See my answer in this post for an example → add wildcard in a dropdown list.

Note: Sample used HSQLDB as question showed LIMIT. Firebird works same except LIMIT is replaced with ROWS x to y.