-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Help Required to Sort by using criteria interface.
PostPosted: Tue Jun 21, 2011 7:14 am 
Newbie

Joined: Tue Jun 21, 2011 6:59 am
Posts: 1
I have a table employee. The table structure is as follows


empid empname
1 vinay shetty
2 arun kumar
3 prashanth malhotra
4 akshay dubey
5 praveen kini
6 mukund pai


Now i need to write a query by using Criteria such that the result should be in the sorted of last name.(Shetty,Kumar,Malhotra..).

Corresponding SQL query for mysql is as follows :

select SUBSTRING_INDEX(SUBSTRING_INDEX( empname , ' ', 2 ),' ',-1) AS lastname from employee order by lastname desc


Thanks in advance.

-Arun


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.