prasadmokashi
Programmer
I am using Compute clause......and now I want to order the results based on the computed value.
I referred the documents, but it seems impossible because compute clause itself needs one order by clause.
So for example,
I have records in table1
User Acct
---------------------------
Prasad A
Prasad B
Prasad C
Nitin A
Nitin B
Girish A
Nachiket A
Nachiket B
if I run,
select User, Account
from Table1
order by User
compute count(Account) by User
I should get
Prasad A
Prasad B
Prasad C
----
3
Nitin A
Nitin B
----
2
Nachiket A
Nachiket B
----
2
Girish A
----
1
As you can see from above expected output I want users with maximum no of accounts come first in the list.
Do you know any way to do this ??
Thanks,
Prasad
I referred the documents, but it seems impossible because compute clause itself needs one order by clause.
So for example,
I have records in table1
User Acct
---------------------------
Prasad A
Prasad B
Prasad C
Nitin A
Nitin B
Girish A
Nachiket A
Nachiket B
if I run,
select User, Account
from Table1
order by User
compute count(Account) by User
I should get
Prasad A
Prasad B
Prasad C
----
3
Nitin A
Nitin B
----
2
Nachiket A
Nachiket B
----
2
Girish A
----
1
As you can see from above expected output I want users with maximum no of accounts come first in the list.
Do you know any way to do this ??
Thanks,
Prasad