是否有有效的算法来确定项目配置文件并选择与查询匹配的配置文件?Mysql剖析项目并选择匹配的配置文件
例如
TABLE MEN
id name
1 man1
2 man2
3 man3
TABLE PROPERTIES
id name
1 health_points
2 strenght
3 speed
TABLE MEN_PROPERTIES
id man_id property_id property_counter
1 1 1 1000
2 1 2 100
3 1 3 50
4 2 1 100
5 2 2 200
6 2 3 100
7 3 1 100
8 3 2 10
9 3 3 5
这意味着
man1 {
health_point:1000,
strenght:100
speed:50
}
man2 {
health_point:100,
strenght:200
speed:100
}
man3 {
health_point:100,
strenght:10
speed:5
}
比方说,我在man_1工作,我们直观地了解它的轮廓与man_3轮廓相匹配。我希望mysql将man_3作为与man_1配置文件匹配的配置文件返回。
达到结果的最佳方法是什么?
为什么man_3与man_1相匹配? – 2013-04-10 12:40:54
好吧,它与man_1平衡,但价值较低,我在寻找比例匹配 – Mike 2013-04-10 12:42:22
是的,如果man3 {health_point:100,strenght:20,speed:5}和man4 {health_point:100,实力:10,速度:5 }他们都匹配,但man_4是最接近的 – Mike 2013-04-10 12:45:07