13.1.  Examples:

13.1.1. group by

In a table with:

create table 
            values

    (cno integer not null primary key,

        type char(20) not null,

        date timestamp not null,

        value number not null

   )

          

You need a query with:

Select type, sum(value) as sumValue where date < ? 
group by type having sumValue > ?

Because the date should be selected by the user, you can not use a fixed view in the database. However, this is possible using the query element in dbforms_config.xml:

            <dbforms-config>
...

            <query name="valuesGroup" from="values" groupBy=type>
    <field="type" type="char">
    <field="sumValue" expression=sum(value) type="number">
    
    <search="date" type="timestamp">
    
</query>     

          

13.1.2. join

            <dbforms-config>
...

            <query name="viewname" from="table1 left join table2 on table1.id = table2.id">
    <field1 type=char>
</query>      

          

13.1.3. Simple alias

            <dbforms-config>
...

            <query name="aliasname" from="table" />

          
  • can be used to have the same table more than once on a page.

  • inherits all field definitions from the table.

  • is updateable!

  • may be another query.