Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

DADE and Sort by fields when grouping

edited February 2003 in End User
I have selected tables, fields and joins. I have definied a grouping
condition. I have defined a "sort by" on a field of my table which is NOT in
the select fields list. This is something which doesn?t work in real live,
but does in RB preview. Why?

If my sql is a simple joined select, it is ok to have all fields available
to select form them for the sort by. If there is a grouping condition, it
would be better to have only the fields from the select list. Additionally
my calclulated fileds are not available for sorting in the list.

Cheers
Bernd

Comments

  • edited February 2003
    Hi Bernd,

    what database are you using?
    I have no problem in using ...

    SELECT myField
    FROM myTable
    ORDER BY mySortField

    ... with the database I'm using.
    Calculated fields are available for sorting here.

    regards,
    Chris Ueberall;
  • edited February 2003
    Hi Chris,

    You are right, I overlooked that the fields are appenden at the end of the
    list. My fault - sorry.

    in
    live,

    I can construct the following SQL by selecting from the lists

    SELECT COUNT(*) COUNT_2
    FROM TBLMW TBLMW
    GROUP BY TBLMW.MZCD
    ORDER BY TBLMW.PERSONID

    wich isn?t a correct SQL statement. No problem for me, but I think it would
    be possible the exclude the fields in a grouping situation.

    rgds
    Bernd
  • edited March 2003
    Bernd,


    the grouping clause is correct in your example but not not the order clause.
    Sure it would be possible to exclude some fields in some situations, but that's no fun!
    You have to re-invent the SQL logic of every database, which ,in addition, changes from time to time.
    The only solution for this dilemma would be a SQL builder published by the database vendors. But that's an illusion.

    regards,
    Chris Ueberall;
  • edited March 2003
    Chris,

    SQL is standardized, RB sticks to this standard and the SQL builder is a
    tool for building SQL statements (without having to know the exact syntax
    and limitations!). And using the SQL builder it is possible to cosntruct a
    statement, that won?t execute.

    I just tried to point out, that maybe DM should have a look at this. No need
    to justify anything.

    Bernd

This discussion has been closed.