traxion Posted March 9, 2009 Share Posted March 9, 2009 i've got a mysql table images with a field id, game_id, datum (time in dutch), aantal (amount in dutch) and some more field, but those not mater right nowinside the table i will save the time and game_id of the images and how much there are uploaded, the images names are not saved inside the database. i will pick those out of the maps on the server.now i want to select the last 10 images for example. The idee was that i just needed to calculate the SUM of aantal until i've hit the 10.this can be in 1 record or in 7 records. SELECT SUM(aantal) as b FROM `images` WHERE game_id = 10020 AND b > 10 now i want to create a query like that but im not sure how?does anybody here has an idee?running a query with LIMIT 1 record and then with LIMIT 2 (+1) until the limit is reached is not really a solution.. thats not nice Link to comment Share on other sites More sharing options...
traxion Posted March 10, 2009 Author Share Posted March 10, 2009 as a solution i've get now the amount out of the dir on the serverif somebody finds a way to do it with sql, im still eager to hear it Link to comment Share on other sites More sharing options...
Stefano Posted March 24, 2009 Share Posted March 24, 2009 select id, game_id, datum, aantalfrom imagesorder by datum desclimit 10 I don't know whether I've understood your request, is this the solution?regardsstefano De Boni Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.