SQL Direct vs. SQL Designer

Tim <[email protected]>
Newsgroups gmane.comp.openoffice.dba.user
Message-ID <[email protected]>
Hi,
I am interested in knowing why SQL statements in SQL Direct are 
dramatically changed when switching over to SQL Designer and then back 
to SQL Direct.  Also when running reports it appears that the Report 
Wizard defaults to SQL Designer when interpreting a report based on a 
query.  Is this correct behavior and is there any way default a report 
to SQL Direct?

The facts:
Windows XP
OOo 2.1
HSQLDB

This works in Base when using sql directly.  It breaks in sql designer.

SELECT
    "t1"."ID" AS "ID",
    "t1"."xref" AS "Xref",
    "t1"."debit" AS "Debit",
    "t1"."credit" AS "Credit",
    SUM( "t2"."credit" ) - SUM( "t2"."debit" ) AS "Balance"
FROM
    "journal" AS "t1", "journal" AS "t2"
WHERE
    ( ( "t1"."ID" >= "t2"."ID" ) )
GROUP BY 
    "t1"."ID", "t1"."xref", "t1"."debit", "t1"."credit", "t1"."credit"
ORDER BY
    "t1"."xref"
ASC
       
This gives me a running balance in standard SQL.
In the report wizard, a static report can be created using this query, 
but the Balance column is filled with the actual balance of this table 
not the running balance.  It fails completely in making a dynamic report 
whether creating it now or modify it. The result is one line of the 
generic hash that normally shows before the actual data is displayed.
In testing this query, it works as it is suppose to when the Run SQL 
Command Directly(RSCD).  When the RSCD button is turned off the result 
is as expected except that the Balance column is filled with the actual 
balance of the table not the running balance that the SQL statement 
should give.  When the Design View is turned on then off, the result is 
one line of what would be the final line of the query.

Below is what happens when Design View is turned on then off:

SELECT
    "t1"."ID" AS "ID",
    "t1"."xref" AS "Xref",
    "t1"."debit" AS "Debit",
    "t1"."credit" AS "Credit",
    SUM( "t2"."credit" ) - SUM( "t2"."debit" ) AS "Balance"
FROM
    "journal" AS "t1", "journal" AS "t2"
GROUP BY
    "t1"."ID", "t1"."xref", "t1"."debit", "t1"."credit", "t1"."credit"
HAVING
    ( ( "t1"."ID" >= "t2"."ID" ) )
ORDER BY
    "Xref"
ASC

Any feedback would be appreciated.

Thanks,

Tim
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.