Forum Moderators: coopster

Message Too Old, No Replies

count(*) in mysql

having problems with counting items in the database

         

Arces

8:48 pm on Jun 10, 2005 (gmt 0)

10+ Year Member



Well... I have a database from which I want to count all the fields containing 2 elements matching the given mysql query. Uh... That probably didn't clarify a thing.
Anyway, the point is that I'm using the following query:
SELECT COUNT(*) FROM blah WHERE blah1=5 AND blahblahblah LIKE '%somestring%'
but for some reason it never returns positive values, although I don't see any problems with the syntax. Any ideas where I might have went wrong?

jatar_k

8:50 pm on Jun 10, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



why not count a specific field and assign it?

SELECT COUNT(myid) as totalrows FROM blah WHERE blah1=5 AND blahblahblah LIKE '%somestring%'

<added>and Welcome to WebmasterWorld

Arces

8:53 pm on Jun 10, 2005 (gmt 0)

10+ Year Member



Ah, good idea.
And thank you ;)