The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Query to combine 2 tables?
Hi all,
I am using a postcounthack (the one of touchingvirus) and I wanted to show on forumhome the top10threadstarters in a specific forumid. Well, this query works and shows the statistics of the members: [sql]$stats10 = $DB_site->query('SELECT `threadcount`.`userid`,`threadcount`.`count1`, `user`.`userid`,`user`.`username` FROM threadcount, user Where `user`.`userid`=`threadcount`.`userid` ORDER BY `threadcount`.`count1` DESC LIMIT 0,10');[/sql] However, while it shows the threadcount, it doesn't link the userid to the username. (And, the username isn't being stored in the threadcount-table) So, how do I combine this query with the user-table to display the username next to the threadcount? |
#2
|
|||
|
|||
I guess I wasn't really clear about what I would like to do, so I hope this info will make it a bit easier to help me.
I'm trying to combine 2 tables like this: I have 2 tables, postcount and user postcount has field userid user has field userid user has field username How do I combine these so I can display the username together with the postcount for each userid? I tried to do: [sql] $postcountuser = $DB_site->query(" SELECT userid, user FROM postcount, user where user.username=postcount.username order BY username"); [/sql] But, mysql considers this ambigious. What am I doing wrong here? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|