Previous Thread
Next Thread
Print Thread
Hop To
Joined: Apr 2007
Posts: 120
member
member
Joined: Apr 2007
Posts: 120
I had a request to determine the number of members that had a particular forum on their "watch list".

I did a simple query on the "ubbt_WATCH_LISTS" table but it didn't give me the info I was hoping for.

I'm just looking for a number, not necessarily a list of members. But if it was a list I can easily count them up and provide that.



Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
Code
SELECT COUNT *
FROM ubbt_WATCH_LISTS
WHERE WATCH_ID = XX
AND WATCH_TYPE = 'f'

XX - the forum id you are concerned with

Joined: Apr 2007
Posts: 120
member
member
Joined: Apr 2007
Posts: 120
Originally Posted by Sirdude
Code
SELECT COUNT *
FROM ubbt_WATCH_LISTS
WHERE WATCH_ID = XX
AND WATCH_TYPE = 'f'

XX - the forum id you are concerned with

SD, excellent.

I had made some progress and was working on getting it refined it to get just the count..

Here's where I was just now..

Code
SELECT USER_ID, WATCH_ID, WATCH_NOTIFY_IMMEDIATE, WATCH_TYPE
FROM ubbt_WATCH_LISTS, ubbt_FORUMS
WHERE FORUM_ID = "20" AND WATCH_TYPE = "f"

I like yours better! smile

Last edited by Island Piper; 11/01/2007 4:27 PM.
Joined: Apr 2007
Posts: 120
member
member
Joined: Apr 2007
Posts: 120
Well durn, I tried your version and it threw an error.

Quote
SELECT COUNT * FROM ubbt_WATCH_LISTS WHERE WATCH_ID = 20 AND WATCH_TYPE = 'f'

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM ubbt_WATCH_LISTS WHERE WATCH_ID = 20 AND WATCH_TYPE = 'f'' at line 1

I'm using mySQL 5.0.37

Joined: Apr 2007
Posts: 120
member
member
Joined: Apr 2007
Posts: 120
Eh, I think I fixed it.

Changed the 'select count *' to 'select count(*)'




Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
good one smile i got back/forth between mssql and mysql and i typed that puppy in real quick.

you show an industrious nature that is good stuff wink


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
Is UBB.threads still going?
by Aaron101 - 04/01/2022 8:18 AM
Who's Online Now
3 members (Ruben, Nightcrawler, 1 invisible), 830 guests, and 271 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)