我正在研究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