![]() |
Can't get MySQL JOINs to work right
I am trying to write a single query that does the following:
- reads all threads where forumid = $forumid - reads all posts where threads.firstpostid = postid - reads all polls where threads.pollid = pollid, but only if a poll exists I tried: PHP Code:
|
Use LEFT JOIN's.
|
I don't think this has the same meaning as what I suggested in my first post, but here it is with LEFT JOINs and still not working (database error):
Code:
SELECT thread.*, post.*, IF(thread.pollid = poll.pollid, 'poll.*', '') |
What's the error given?
|
Code:
SQL query: Was returning NULL because I somehow deleted every record in my post table. Good thing I made a backup yesterday. Now the query works as expected: Code:
SELECT thread.*, post.* |
All times are GMT. The time now is 03:34 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|