New Posts New Posts RSS Feed: What is the best practice for "Select Max(field) from table where conditions" with ideablade query l
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

What is the best practice for "Select Max(field) from table where conditions" with ideablade query l

 Post Reply Post Reply
Author
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Topic: What is the best practice for "Select Max(field) from table where conditions" with ideablade query l
    Posted: 16-Jul-2007 at 11:17am

What is the best practice for "Select Max(field) from table where conditions" with ideablade query language?

Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 16-Jul-2007 at 11:22am
This is one case where it might be best NOT to use OQL because you will have to retrieve all of the records in the table from the Server to the Client, and then compare the field of interest for each row of the table.  This is definitely slower than using a passthrough query using the MAX function.
 
If you must use OQL, then I would create a dynamic entity with 2 columns.  One column would be the primary key column, and the second column woulld be the column you were trying to find the MAX function.  You still are retrieving all of the records in the table, but you are retrieving only two columns of the table instead of all of the columns.
 
If you are not quite sure how to query against dynamic entities, look at the Developer's Guide.  There is also a Tutorial on Dynamic Entities.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down