Jump to content
We've recently updated our Privacy Statement, available here ×

[Resolved] SQL Order By a parameter


max_max_mir

Recommended Posts

I am trying to order by a column in my SQL query, but this column I am trying to order by depends on a parameter to be supplied by the end user. Any suggestions how to do it?

SQL Query: Select * from table1 order by $P{param1}

The problem is, $P{param1} is of type String, and in the query, it gets translated to a string with quotes. On the other hand, an expression like Select * from table1 order by $P{param1}.equals("column1")?column1:column2 doesn't work either.

Solution: use an exclamation after P -  $P!{...}



Post Edited by max_max_mir at 08/11/2010 17:30
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...