【发布时间】:2011-03-05 11:33:55
【问题描述】:
我正在 PostgreSQL 中进行搜索查询,我做的一件事是按匹配的参数数量对查询结果进行排序。我不知道如何做到这一点。有没有人有建议或解决方案?
Table
brand color type engine
Ford Blue 4-door V8
Maserati Blue 2-door V12
Saturn Green 4-door V8
GM Yellow 1-door V4
Current Query
SELECT brand FROM table WHERE color = 'Blue' or type = '4-door' or engine = 'V8'
Result Should Be
Ford (3 match)
Saturn (2 match)
Maserati (1 match)
【问题讨论】:
标签: sql database postgresql search