Hi Lesta,

Thanks for the help and it works!!

Just wondering, why my way was not working? Any reasons why?

Regards

Eka

----- Original Message ----- From: "Uwe Lesta" [EMAIL PROTECTED]
To: <[email protected]>
Sent: Tuesday, August 08, 2006 7:21 PM
Subject: Re: ORDER BY CLAUSE




Eka Gautama wrote:

HI guys,

I am having problem currently. I have a very simple query with ORDER BY clause, but I want to give parameter to what I am going to order. The parameter is comes from the UI.

Here is the SQL MAP :

<select id="QueryBranch" resultClass="HashTable" parameterClass="HashTable">
 SELECT  BRANCH_CODE ,OFFICE_CODE FROM   BRANCH_MASTER
 ORDER  BY #SortExpr# ASC
</select>

#SortExpr# will be either BRANCH_CODE or OFFICE_CODE which is supplied from UI.

The above statements give me result but not in order that I want. But, if I change into like this :

<select id="QueryBranch" resultClass="HashTable" parameterClass="HashTable">
 SELECT  BRANCH_CODE ,OFFICE_CODE FROM   BRANCH_MASTER
 ORDER  BY OFFICE_CODE ASC
</select>


It gives me the correct order of the records.

try something like

<dynamic prepend="ORDER BY ">
<isNotEmpty property="SortField">
$SortField$ $SortDirection$
</isNotEmpty> </dynamic>


--

Kind regards

Uwe
Lesta at SBS-Softwaresysteme.de



Reply via email to