![]() |
Quote:
LEFT JOIN forum f ON f.forumid = t.forumidpostid Should be: LEFT JOIN forum f ON f.forumid = t.forumid After fixing the typo it works great, thanks! |
Here is how I am using your script. Everything on the page is pulled from the database using your script (except for the racing map)
http://www.pocketbikeplanet.com/view.php?pg=racing I'm also using it for other areas of the site as well. I've been a VB admin for over 4 years now and this is by far my favorite script. :) P.S. To others using this script, please don't send me PM's or Email's for help. Post you questions in this thread and I'll try and help. |
Quote:
I have created a template which does a standard search of a database and displays the results. Problem is that there is no header and footer like there is with HTML pages. |
How do I tell the code below to show the last 3 posts from each forum and sort them by forum?
This is what I have so far... SELECT t.threadid, t.title, t.firstpostid, t.lastpost, f.title as forumtitle, t.replycount, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, p.pagetext, t.iconid, t.forumid FROM thread t LEFT JOIN post p ON p.postid = t.firstpostid LEFT JOIN forum f ON f.forumid = t.forumid WHERE t.forumid IN ( 19, 116 ) AND t.open = '1' AND t.visible = '1' ORDER BY forumtitle DESC LIMIT 0 , 3 |
Just an update on my progress...
I tried using the code: SELECT t.threadid, t.title, t.firstpostid, t.lastpost, f.title as forumtitle, t.replycount, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, p.pagetext, t.iconid, t.forumid FROM thread t LEFT JOIN post p ON p.postid = t.firstpostid LEFT JOIN forum f ON f.forumid = t.forumid WHERE t.forumid IN ( 19, 116 ) AND t.open = '1' AND t.visible = '1' GROUP BY f.title ORDER BY forumtitle DESC LIMIT 0 , 3 The code above does two things that confuse me. (Keep in mind I am a very novice mySQL guy, so I am easily confused) ;) #1. It only grabs one thread from each forum. (2 threads total on the page even though the limit is set to 3) #2. The thread that it grabs is the oldest thread, not the newest one. I've tried so many different query's I'm about ready to pull my hair out. Any ideas Logician?? |
This is an extreme difficult thing to do in just 1 query. I have seen your other post about this also, but didn't have a brainwave for a solution yet. Maybe when i wake up. :D
|
You're only getting two rows in your result because your are grouping by forum and you are selecting from 2 forums.
I don't have a quick solution either. But I would start looking at nested selects, maybe. |
Quote:
|
Quote:
I admit I'm way over my head here with mySQL query syntax knowledge. |
Quote:
Logician - any help on my question above, please? |
All times are GMT. The time now is 09:42 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:
|