Substituting tables for querries in a querry

I’m recreating a database and wanting to re-use some of the queries that other people helped me create with sql. To get rid of repeated varchar values I made one table into two with new names and the a query with the same name as the original table and all of the same fields.

When I tried to use the old query on the new query I got this error:

The data content could not be loaded. at ./connectivity/source/commontools/dbtools.cxx:746
SQL Status: 42501
Error code: -5501

user lacks privilege or object not found: annual_cultivation at ./connectivity/source/drivers/jdbc/Object.cxx:173

In the original databse, annual_cultivation was a table. Now it is a query.

This is the query that I’m trying to reuse

SELECT "latin_name", "start_month", "start_day", "end_month", "end_day", "practice", "detail","phenological_event"  FROM "annual_cultivation" WHERE "start_month" IS NOT NULL 

union all
SELECT "annual_cultivation"."latin_name", "phenology_dates"."start_month", "phenology_dates"."start_day", "phenology_dates"."end_month", "phenology_dates"."end_day", "annual_cultivation"."practice", "annual_cultivation"."detail","annual_cultivation"."phenological_event"  FROM "annual_cultivation", "phenology_dates" WHERE "annual_cultivation"."phenological_event" = "phenology_dates"."phenological_event" AND "annual_cultivation"."phenological_event" IS NOT NULL


ORDER BY "end_month" ASC, "end_day" ASC, "start_month" asc, "start_day" ASC`Preformatted text

A query with UNION will be a query in direct SQL mode. So it won’t be interpreted by Base GUI. The (internal) database don’t know anything about queries, which are only saved in Base GUI. You could create a view from the query “annual_cultivation”.

1 Like

Base is crippled compared to MS-Access.

Agreed, but the same thing is called “pass-through query” in MS Access.

1 Like

A simple code editor with syntax highlighting is your friend since the SQL dialog lacks a find/replace.