I have three very basic tables set up for testing an sql command I want to try and I'm getting lots of problems. Here's the table list:
Table: profiles
Field: ID, Login
Table: themes
Field: ID, ProfileID, Timestamp, ThemeBuild, Title, Description
Table: comments
Field: ID, ThemeID, Comment
I'm aimming to get the theme title, description, and timestamp, the corresponding Login name (profiles.ID=themes.ProfileID), the lastest build (MAX(themes.ThemeBuild)), and the number of comments (COUNT(Comments.ID))
This is the closest I got to what I was aimming at:
SELECT themes.Title, profiles.Login, themes.Timestamp, MAX(themes.ThemeBuild), themes.Description, COUNT(comments.ID) FROM themes, profiles, comments WHERE profile.ID=themes.ProfileID AND comments.ThemeID=themes.ID GROUP BY
themes.ID
It's almost right... the only thing that's wrong is the MAX(themes.ThemeBuild) doesn't return the largest ThemeBuild field.
Any clues?