所以我的查询:
SELECT Tags, COUNT(Tags) AS Listings
FROM Job
WHERE datepart(year, dateposted)=2013
GROUP BY Tags
ORDER BY Listings DESC
输出:
+----------------------+----------+
| Tags | Listings |
+----------------------+----------+
| java c++ | 41 |
| software development | 41 |
| java c++ c# | 31 |
| | 25 |
| sysadmin | 25 |
| see jd | 24 |
| java c++ ood | 23 |
| java | 23 |
+----------------------+----------+
我希望它像这样出来:
+----------------------+----------+
| Tags | Listings |
+----------------------+----------+
| java | 118|
| c++ | 95 |
| ood | 23 |
| see | 24 |
| jd | 24 |
| software development | 41 |
| sysadmin | 25 |
| c# | 31 |
+----------------------+----------+
如何计算字段中的每个单词而不是整个字段?标签列是 nvarchar。