Re: Counting the occurence of a string ...



DaFerg (dave@xxxxxxxxxxx) writes:
I have a weblog database where I want to count the occurences of a
table of string values that appear in all the urls viewed.

My tblWebLog as a field that contains the url ...
tblWebLog.[cs-uri-stem]

I have another table ... tblStrings ... that has a field [strSearch]
for a string value and an integer field [intViewCount] to count the
occurence of the string in tblWebLog.[cs-uri-stem]

I've been trying ...

Update tblStrings
Set [intViewCount] = (Select Count(*) From tblWebLog Where
[cs-uri-stem] Like '%_' + tblStrings.[strSearch] + '.htm%')

... but it doesn't fly and I'm stumped. Any thoughts?

Your query make sense in relation to your description, but then again I
may be misunderstanding something.

For this sort of question, it helps if you post:

o CREATE TABLE statements for your tables.
o INSERT statements with sample data.
o The desired result given the sample.

This helps to clarify what you are looking for, and it makes it possible
to copy and paste and develop a tested solution.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: time conversion hiccup
    ... We have only seen fragments and pieces of what you have been doing. ... statements with sample data, and the desired result given the sample. ... Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books ... ...
    (comp.databases.ms-sqlserver)
  • Re: Problem With SQL UPDATE
    ... INSERT statements with sample data. ... With the first three it's to copy and paste into a query editor to ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: SQL question
    ... JOIN tbl b ON a.UserID = b.UserID ... INSERT statements with sample data. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: I want to parse @ArrayOfDays into @d1 through @d5
    ... @char - current char in string ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Many to one Select
    ... It still possible to define a query that has maximum of columns needed, ... INSERT statements with sample data. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)