aschulz90 Posted July 28, 2008 Share Posted July 28, 2008 Hi, I am making a page (or trying to) that would enable users to view the newest agenda for each board in our local government. I can do that for the most part (I'm really starting to like php), but my problem is: I would like to be able to post only the content of the newest row on a table. (there will be one table per board/commitee/commission) I know how to do: $query = "SELECT max(Uploaded) FROM ".$group; What I want to do is this but MySQL doesn't like it: "SELECT date FROM ".$group." WHERE Uploaded = Max(Uploaded)"; and I would need to use this same concept to get all the other fields in separate variables too. My fields are (Field_name, Data_type);: (Uploaded, timestamp);(Date, Text); (Time, Text); (Location, Text); (DocLoc, Text); (Docloc will be the location of the Agenda's syllabus). Quote Link to comment Share on other sites More sharing options...
Barand Posted July 29, 2008 Share Posted July 29, 2008 Do Date, Time, Location and DocLoc really need to be 65000 chars long? Why multiple tables for board/commitee/commission and not a single table storing board/commitee/commission in each row? Anyway, SELECT Date, Time, Location, DocLoc FROM tablename WHERE uploaded = (SELECT MAX(uploaded) FROM tablename) Quote Link to comment Share on other sites More sharing options...
aschulz90 Posted July 30, 2008 Author Share Posted July 30, 2008 Thank you very much, that really simplifies what I ended up doing which used two functions that now seem unnecessary. I will change the fields to something more appropriate. Lastly I do think each table is a good thing because if you have an additional field with the for the name of the board committee or commission that means alot more data which does not need to be stored over and over again. thanks so much for the other tips. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.