Herod Posted November 15, 2007 Share Posted November 15, 2007 Hello, I have this mysql data: nIdAg | sTypeAg | sNameEventAg | dDateAg | sArtistAg | sLocationAg | sBileteAg | sDescriereRoAg | sDescriereEnAg | sPosterAg | nDeletedAg | nPrimaAg 1 | Concert | concert 20 | 2007-11-20 | concert 20 | concert 20 | concert 20 | concert 20 | concert 20 | deep_p_romania.jpg | 0 | 0 2 | Concert | concert 18 | 2007-11-18 | concert 18 | concert 18 | concert 18 | concert 18 | concert 18 | metalcamp_logo_fest_2007.jpg | 0 | 0 3 | Clubbing | Clubbing 27 | 2007-11-27 | Clubbing 27 | Clubbing 27 | Clubbing 27 | Clubbing 27 | Clubbing 27 | deep_p_romania.jpg | 0 | 0 4 | Clubbing | Clubbing 20 | 2007-11-20 | Clubbing 20 | Clubbing 20 | Clubbing 20 | Clubbing 20 | Clubbing 20 | picture_clubz.jpg | 0 | 0 i tried to used group by sTypeAg and order by dDateAg to get the infos about the most recent event that took place for one type of event. so i am trying to display in a while in php a list with the most recent shows that will happend. I don;t know why it's just show me the first occurence in the database for every type of shows. in this case i want to display the concert that will took place in 2007-11-18 and the clubbing that will take place on 2007-11-20. can anyone help me please? Quote Link to comment Share on other sites More sharing options...
Herod Posted November 15, 2007 Author Share Posted November 15, 2007 ok. i found out the solution: SELECT DISTINCT sTypeAg, MIN( dDateAg ) FROM t_agenda GROUP BY sTypeAg ORDER BY dDateAg ASC 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.