calculate score in ms sql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • codekhan
    New Member
    • Mar 2008
    • 2

    calculate score in ms sql

    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?
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by codekhan
    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

    Comment

    • Brad Orders
      New Member
      • Feb 2008
      • 21

      #3
      I'm not sure, but is this the kind of thing you are after?

      Code:
      SELECT C1
      FROM TableName
      WHERE C1 = @SomeParameter
      ORDER BY C2, C3, C4
      If you want to order the results by a column in descending order, just put DESC after the column name (eg. "C2 DESC")

      HTH.

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by codekhan
        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.

        Comment

        Working...