counting occurances of a string in a field

counting occurances of a string in a field

Post by Palloqui » Thu, 10 Aug 2000 04:00:00



Hi there....

I know how I can see if a certain string is in a certain field on my DB
using a:
"SELECT * FROM table WHERE field LIKE '[*sting*]'

But what I'd like to know is the number of times the string is in the
field...

Is there a way to find out using a SQL statement???

TIA!

Palloquin

 
 
 

counting occurances of a string in a field

Post by Elise Vennéguè » Thu, 10 Aug 2000 04:00:00


You want to know the number of times the string is in the
field... so you have to count

just try : SELECT COUNT(*) FROM table WHERE field LIKE '[*sting*]'
Hope it's help you


> Hi there....

> I know how I can see if a certain string is in a certain field on my DB
> using a:
> "SELECT * FROM table WHERE field LIKE '[*sting*]'

> But what I'd like to know is the number of times the string is in the
> field...

> Is there a way to find out using a SQL statement???

> TIA!

> Palloquin


 
 
 

counting occurances of a string in a field

Post by Douglas J. Steel » Thu, 10 Aug 2000 04:00:00


That won't do it: that will tell you how many rows in the table had a field
with sting anywhere in it, not how many times sting appeared in a single
field.

I don't think there is any way to calculate it using SQL.

--

Doug Steele, Microsoft Access MVP
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://I.Am/DougSteele/


> You want to know the number of times the string is in the
> field... so you have to count

> just try : SELECT COUNT(*) FROM table WHERE field LIKE '[*sting*]'
> Hope it's help you


> > Hi there....

> > I know how I can see if a certain string is in a certain field on my DB
> > using a:
> > "SELECT * FROM table WHERE field LIKE '[*sting*]'

> > But what I'd like to know is the number of times the string is in the
> > field...

> > Is there a way to find out using a SQL statement???

> > TIA!

> > Palloquin

 
 
 

1. Counting occurances of a string in a field..

Hi there..

This is actually a query for mySQL but I figured I'd see if there was a SQL
Server command that'd do the job cos there'd be half a chance of a mySQL
equivalent.. or if it comes to it i'll just use SQL server for the site..
(got a copy, just not quite got round to playing with it yet)

Cheers,

Ryan

2. Restoring Master DB

3. Count occurances in a row

4. MS-SQL NT Question

5. SQL: Counting occurances

6. Check if Record exists - sproc

7. Count Distinct Occurances of a Measure in the Fact table

8. DataBase Comparisons

9. Counting occurances of a datatypes in a database - HELP on SQL for this appreciated

10. Counting occurances

11. Query- Count how many occurances of certain text in a column

12. Number of occurances of a character in a string

13. Count occurences of several string in a Memo (VARCHAR(5000) field