後,我有一個SQL保持在MySQL SQL命令
select site_id,count from tags where match (tag) against ('statistici' in boolean mode) ORDER BY count DESC;
+---------+-------+
| site_id | count |
+---------+-------+
| 9 | 1300 |
| 13 | 1200 |
| 9 | 1100 |
| 13 | 1000 |
| 9 | 900 |
| 13 | 800 |
| 13 | 800 |
+---------+-------+
什麼,我需要的是讓不同的SITE_ID。 但是當我通過語句中使用一組由數的順序沒有保持
select site_id,count from tags where match (tag) against ('statistici' in boolean mode) GROUP by site_id ORDER BY count DESC;
+---------+-------+
| site_id | count |
+---------+-------+
| 13 | 1000 |
| 9 | 900 |
+---------+-------+
我應該怎麼辦?
我的解決方案將是SELECT site_id FROM(選擇site_id,從標籤t開始計數,其中match(tag)針對(布爾模式下的'statistici')ORDER BY count DESC)s GROUP by s.site_id;但我沒有ideea,如果這是優化 – keepwalking 2011-01-29 11:56:49