tags:

views:

13

answers:

1

Hi, I have a table called Users in my database. Let's assume that User has only 3 properties

int ID; string? Name; string Login;

If user doesn't specify his name then Login is displayed. Otherwise Name is displayed. I wan't to get list of all users sorted by what is displayed. So if user specified Name, it is taken into consideration while sorting, otherwise his position on the list should be determined by Login. Eventually whole list should be ordered alphabetically. I hope I made myself clear...

Is that possible to do in HQL?

A: 

Just if someone have similar problem in future:

"order by coalesce(u.Name, u.Login) asc"
Episodex