Ordering a dataset using TQuery (and yes I know how to use an ORDER BY!)

From: Manney (nospam_at_mycompany.com)
Date: 10/28/04


Date: Thu, 28 Oct 2004 15:34:44 +0100

Now I know this sounds like a dunce question but there is more to it than
what you think!

two database tables

Table A -
CatID int*
CatDesc varchar
DisplayOrder int

Table B -
AnotherID int*
CatID int*
field1 char
field2 char
field3 char

* primary keys

i am trying to write a "simple" data-aware maintenace utility for TableB
that will allow the user to EDIT field1-3 values using a dbGrid attached to
a RequestLive Tquery

no problem so far!

in the grid
I want to display the CatDesc and order the contents of the grid by
DisplayOrder

If i create a lookup field to get the CatDesc field, That works, I can
retrieve a RequestLive result set

but how do i sort the data?

If i join the two tables and use an order by statement, I cannot open a
requestlive result set.
I have tried adding the display order as another lookup field and ordering
it that way, you can't do that.
Tried adding it as a calculated field and ordering it like that but again
you can't do that
Also tried using a tTable component instead, adding a calculated field and
applying the displayorder field as an index field after opening the dataset,
but you can't do that either

I know you can do this easily using ADO datasets but we use delphi 5pro and
we don't have any ADO comps
Does anyone know of a simple way to do this