请用sql server语句统计fpath中/字符出现次数,并截取第二个/后的字段
时间: 2023-03-13 12:58:45 浏览: 101
将txt与excel文件导入SQLServer数据库的sql代码
5星 · 资源好评率100%
SELECT SUBSTRING(fpath, CHARINDEX('/', fpath, CHARINDEX('/', fpath) + 1) + 1, LEN(fpath) - CHARINDEX('/', fpath, CHARINDEX('/', fpath) + 1)) AS substr, COUNT(*) AS cnt FROM table_name GROUP BY substr ORDER BY cnt DESC;
阅读全文