By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,144 Members | 1,286 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,144 IT Pros & Developers. It's quick & easy.

calculate score in ms sql

P: 2
Hi,



Suppose I have a table with 5 rows (t1 - t5) and 6 columns (c1 - c6) and I run a select query on it using the where clause.. (specifying value of c1) and in the result I get two rows say T1 and T4 ,,now I want to rank my results based on the other unknown columns..

Is there any way to calculate the rank (score) of the resultant rows?
Mar 2 '08 #1
Share this Question
Share on Google+
3 Replies


ck9663
Expert 2.5K+
P: 2,878
Hi,



Suppose I have a table with 5 rows (t1 - t5) and 6 columns (c1 - c6) and I run a select query on it using the where clause.. (specifying value of c1) and in the result I get two rows say T1 and T4 ,,now I want to rank my results based on the other unknown columns..

Is there any way to calculate the rank (score) of the resultant rows?

if you could post some sample mock data, of your table and what you want to accomplish, it would be much easier..

-- CK
Mar 2 '08 #2

Brad Orders
P: 21
I'm not sure, but is this the kind of thing you are after?

Expand|Select|Wrap|Line Numbers
  1. SELECT C1
  2. FROM TableName
  3. WHERE C1 = @SomeParameter
  4. ORDER BY C2, C3, C4
  5.  
If you want to order the results by a column in descending order, just put DESC after the column name (eg. "C2 DESC")

HTH.
Mar 2 '08 #3

amitpatel66
Expert 100+
P: 2,367
Hi,



Suppose I have a table with 5 rows (t1 - t5) and 6 columns (c1 - c6) and I run a select query on it using the where clause.. (specifying value of c1) and in the result I get two rows say T1 and T4 ,,now I want to rank my results based on the other unknown columns..

Is there any way to calculate the rank (score) of the resultant rows?
Could you please be more specific or your requirement. A sample data with a sample output required will help the experts to better understand your requirement.
Mar 3 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.