Frank Schönheit - Sun Microsystems Germany wrote:

-------- Original Message --------
Subject: [specs-announce] new spec: Queries in Queries
Date: 21 Apr 2006 14:58:15 +0200
From: Frank Schönheit <[EMAIL PROTECTED]>
Reply-To: [email protected]
Organization: StarOffice / Sun Microsystems, Inc.
To: [email protected]

Title   : Context Menus in Impress and Draw

Location: http://dba.openoffice.org/specifications/Queries_in_Queries_.odt

Status  : preliminary

Abstract:
Database queries are an essential feature of any database management
system to provide the user with the possibility to customize the view to
her data. A database query assembles, filters, and sorts information
spread over multiple tables of the relational database.
While up to OpenOffice.org 2.0.4, it is possible to base queries on
tables only, with the implementation of the “Queries in Queries” feature
the user can base queries on other queries as well, treating them as if
they were a server-side table.
This is implemented for OpenOffice.org's default database engine,
HSQLDB, with the option to support other back-ends in the future.

Issues: i51143

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Backing up to this point, in order to follow up on something Regina touched on in her last email and I touched on in the issue tracker.

I think that dragging ( adding ) a query to a query is the same as supporting sub-selects in the parser.

Let's say I have two tables tblNames and tblAddresses. I want a simple query the displays all the fields from both, joined on a Fk field.

SELECT
   "tblNames".*,
   "tblAddresses".*
FROM
   "tblAddresses" "tblAddresses",
   "tblNames" "tblNames"
WHERE ( "tblAddresses"."NameID" = "tblNames"."ID" )

I create a view, that is simply:

CREATE VIEW "vwAddresses" as ( Select * from "tblAddresses" )

I can alter the above select statement to

SELECT
   "tblNames".*,
   "vwAddresses".*
FROM
   "vwAddresses" "vwAddresses",
   "tblNames" "tblNames"
WHERE ( "vwAddresses"."NameID" = "tblNames"."ID" )

The Base query designer will accept this just fine.

If I change it to this instead.

SELECT
   "tblNames".*,
   "ssAddresses".*
FROM
   ( SELECT * FROM "tblAddresses" ) "ssAddresses",
   "tblNames" "tblNames"
WHERE ( "ssAddresses"."NameID" = "tblNames"."ID" )


The designer will no longer accept it, but the HSQL engine will take it just fine. It seems obvious to me that having a query as part of a query is just a matter of making the parser accept sub-selects.





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to