Total weight order

[b]data in myTable[/b]

[COLOR="Blue"]id name   country     city   sex[/COLOR]
1  john    [COLOR="Red"]America[/COLOR]   Denver  [COLOR="Green"]male[/COLOR]
[B]2[/B]  Mary    England   London  female
[B]3[/B]  Judy    France    Chicago   female
4  Tom     German    Berlin  [COLOR="green"]male[/COLOR]
5  Carol   [COLOR="red"]America[/COLOR]   [COLOR="Blue"]Paris[/COLOR]   female
6  Jane    [COLOR="red"]America[/COLOR]   Tokyo   female

I have data in myTable like the above.

when I have America(weight 80%), Paris(weight(50%), and male(weight 20%) as 3 keywords,
I like to output like the below.

[b]target result[/b]

(1) Carol  // 80%+50%=150%(total weight)
(2) John // 80%+20%=120%
(3) Jane // 80%
(4) Tom  // 20%
(5) Mary  // 0% 
(6) Judy  // 0% Judy comes later than Mary because of "ORDER BY [B]ID[/B]" 

The following code doesn’t work correctly, but I hope it shows what I want.

[b]would-be code[/b]

select name from myTable
where 
weight(country,80%)='America'
or
weight(city,50%)='Paris'
or
weight(sex,20%)='male'
order by ID

not even close

is that really your best attempt, after all the hundreds of times i have helped you with SQL???

well, sort of

i don’t understand why you have a WHERE clause, because it looks like you want all rows returned

furthermore, you neglected to mention where the percentages are stored

Not really, Soorry, I might focus on the showing my target instead of making the real code.

I forgot, I am afraid, many parts of your point.
I work in another field for money although my dream is in this field.

Neither do I.
As I found that I should put the weight phrase in ORDER clause, I can’t modify the OP because of sitePoint’s preventing “EDIT” by time-passing.

percentages could be Dynamic.
Server language Page can give the percentages Dynamically. or DataBase can give it.

Let’s suppose that Database has the percentTable like the below.

[b]data in percentTable[/b]

(myField)  percent

country       80
city          50
sex           20

I have to add one more thing,

I’ve never asked about weight before.
This question is the first time relating weight.

Come on, Rudy, please…