PDA

View Full Version : While in mySQL - how would I do this query?


kofoid
09-19-2007, 10:37 PM
I would like to run a query in mySQL that would show me all of the threads started by a certain user and all of the responses tied to the thread. Just like "Find all threads started by XXX" in a member's profile. Can someone help me out? Thanks in advance!

Eikinskjaldi
09-20-2007, 06:00 AM
I would like to run a query in mySQL that would show me all of the threads started by a certain user and all of the responses tied to the thread. Just like "Find all threads started by XXX" in a member's profile. Can someone help me out? Thanks in advance!

if its just the threads you want then its

select * from thread where postuserid=userid

If you want all the posts in all these threads then its

select post.* from post p
join thread t using (threadid)
where postuserid=userid
order by p.threadid, p.postid

kofoid
09-22-2007, 07:13 PM
THANKS!

does that pull all threads and their responses as a single query? Also, is there any way to get it to run exactly like "Find all threads started by XXX," so it shows all pictures, signatures, etc? If not, is there a setting in the admin control panel that will allow someone to see ALL posts based on user group? That way I could set only the admin group to be able to see threads started by x, instead of only the last 100

Eikinskjaldi
09-23-2007, 02:20 AM
THANKS!

does that pull all threads and their responses as a single query?
Yes

Also, is there any way to get it to run exactly like "Find all threads started by XXX," so it shows all pictures, signatures, etc?

Yes. A custom plugin to the appropriate script with some modifications to a few templates should do it.

If not, is there a setting in the admin control panel that will allow someone to see ALL posts based on user group? That way I could set only the admin group to be able to see threads started by x, instead of only the last 100

Not that I am aware.