1
的具體數量對於這樣一個表格中選取項目:包含給定字符(SQL)
visits url
594 http://example.com/page1/stuff
302 http://example.com/page2
494 http://example.com
202 http://example.com/page3/stuff/more
我想選擇只包含4個/
字符的URL。
在python中,我會使用len(url.split('/')) == 5
。這怎麼能在SQL查詢中完成?
它們可以是連續的,以及在它們之間沒有字符的另一序列?例如:'http://example.com ///' –
當然 - 所以在你的例子中,我們會計數5 – AlexG
'length(url)-len(replace(url,'/',''))= 4'? –