我正在研究PostgreSQL中的搜索查询,并且我所做的一件事是通过匹配的参数数量对我的查询结果进行排序。我不知道如何做到这一点。有没有人有建议或解决方案?通过查询中的参数匹配计数进行搜索排序? 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)
完美地工作。谢谢! – 2010-06-18 15:17:35