MySQL Forums
Forum List  »  General

Create a ranking query for given scenario ?
Posted by: Sandhya Gupta
Date: February 16, 2012 05:15AM

id,match,Source,Targets
1,40,61,B5882
2,40,61,B5883
3,40,61,B5889
4,37.5,61,B998
5,33.33,61,B999
6,44.44,322,A011
7,44.44,322,A012
8,44.44,322,B5883
9,44.44,322,B5889
10,42.86,322,B998
11,44.44,62,B64
12,37.5,62,B998
13,33.33,62,B999
14,42.86,5102,A0225
15,42.86,5102,A028
16,50,5102,B001
17,60,5102,B998
18,50,5102,B999
19,42.86,63,B998
20,37.5,63,B999
21,88.89,7103,M3300

______________________________

I would like to ask if anyone knows how to write a query for this requiement.

Requirement :
I want to display only top 2 choices of "Targets" for all given "Source" based on highest match percentage.
__
(As you can see in the sample data , there are multiple entries of targets for a single source code, more than 2 sometimes as high as 5)
__

If anyone can point me in the right direction ill be very thankful. :)



Edited 1 time(s). Last edit at 02/15/2012 11:10PM by Sandhya Gupta.

Options: ReplyQuote


Subject
Written By
Posted
Create a ranking query for given scenario ?
February 16, 2012 05:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.