![]() |
Probably a very easy mysql question.
I'm working on a hilariously simple forum script. Right now to grab all of the thread information I'm doing the following query.
PHP Code:
I have another table called "comments". Here is my table structure. ![]() thread.ID in the "thread" table and threadid in the "comments" table match up. How do I alter my original query so that I can order by comments.date? I've messed about and tried everything I can think of but it always fails. Incidentally you can view the live fail forum here. |
I managed to solve the problem. Rather than trying to do some out-of-my-depth mysql query I added another column to "thread" called "lastupdate". Then each time a new comment was made inserted the current timestamp into the thread table as well as the date column on the comments table.
Now it's working like a charm. |
I'm glad you sorted it. Although when you have queries of this nature that are quite intensive, you should take a look at using MySQL views. I realise it's supposed to be a simple forum package, however, views will add to the efficiency of such queries.
|
Look into joins as well. Thats all that is needed to solve the problem without changing the db.
|
Your table structure graphic are they easy to create?
How do you generate these diagrams of your database tables Is this done in shell access and print screen and copy and paste into photoshhop or is this a spreadsheet graphic. What is the name of these text boxes |
Quote:
|
I assume the screen shots are created through the shell access
|
Yes, those ones are. I am not sure what the name of these tables are. Perhaps ASCII Tables? ASCII Tabular Data?
|
| All times are GMT. The time now is 08:33 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0