Need Help to find the Maximum value of field

In mySQL, i wanna to query like "SELECT max(bookid) from test". How to get the maximum value in Openbiz program?

 <Element Name="fld_bookid" Class="InputText" FieldName="bookid" Label="Bookid" DefaultValue="{@query:FetchField(easy.dataobj.d_main, xxxx, bookid)}"/>
 

I am really newbie in Openbiz. T.T

If i wanna to make a table

If i wanna to make a table that each row has summary from another table such as.

Table 1

USER - TYPE - VALUE
U1 - A - 10
U2 - B - 20
U3 - A -20
U4 - B - 30
U5 - C - 40

Result of Table that wanna to make :
USER - TYPE - VALUE / SUMMARY VALUE
U1 - A - 10/30
U2 - B - 20/50
U3 - A - 10/30
U4 - B - 30/50
U5 - C - 40/40

What should i do? Thank for ur kindness.

Dataobject has SQLExpr

Dataobject has SQLExpr attribute that allows you to use any SQL functions. If you use SQL Aggregate functions in conjunction with regular columns don't forget about group by clause that you can specify in OtherSQLRule attribute of dataobject. Check documentation for details.

-Andrew