I have a table in which logs from a web portal, in this URL is visited, the duration of the request, the referrer
One of these columns is path information and it contains the following strings:
/ admin / / export / / project2 / / Project 1 / News / Project 1 / User / User / ID / 1 / User / ID / 1 / History / User / ID / 2 / Forum / Topic / 14 / Post / 456
This call Want to count on the SQL query a data base, so I would like to know that I can make to overall based on the first part of the path information ?
This will be sent to me as the / admin /
, / export /
, / project1 /
, / project2 / Calculate the number of URLs starting with
,
/ user /
, / forums /
, ...
it's programming language Regex would be easy to create with, but the same work I read does not exist on SQLServer.
I first find the first occurrence of "/" followed by the first letter / ' For the use of fourteenx (), then after the second anything is snatched. Select LEFT (pathInfo, CHARINDEX ('/', pathInfo, 2)) as RootLevelPath, count (*) as left-hand as LEFT (pathInfo , CHARINDEX ('/', pathInfo, 2))
No comments:
Post a Comment