|
|
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
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
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 |
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..
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!
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. 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
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
good one 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
|
|
|
Bots
by Outdoorking - 04/13/2024 5:08 PM
|
|
|
|
|
|
3 members (Ruben, Nightcrawler, 1 invisible),
830
guests, and
271
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
|
|
|