Canman2005 Posted March 25, 2009 Share Posted March 25, 2009 Hi all I want to do a SELECT COUNT(*) as Num FROM log WHERE live = 99 But I only want to perform this on the last 8 rows in the database Is that possible? Quote Link to comment Share on other sites More sharing options...
POG1 Posted March 25, 2009 Share Posted March 25, 2009 SELECT COUNT(*) as Num FROM log WHERE live = 99 ORDER BY `id` DESC LIMIT 8; You will need to change `id` to the primary key field Quote Link to comment Share on other sites More sharing options...
sasa Posted March 25, 2009 Share Posted March 25, 2009 SELECT COUNT(*) as Num (SELECT * FROM log ORDER BY id LIMIT AS a WHERE live = 99 Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted March 25, 2009 Author Share Posted March 25, 2009 both of those seem to give me an error, any ideas? thanks Quote Link to comment Share on other sites More sharing options...
trq Posted March 25, 2009 Share Posted March 25, 2009 SELECT COUNT(*) as Num FROM (SELECT * FROM log ORDER BY id LIMIT AS a WHERE live = 99 Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted March 25, 2009 Author Share Posted March 25, 2009 thanks dude Quote Link to comment Share on other sites More sharing options...
sasa Posted March 25, 2009 Share Posted March 25, 2009 sorry i miss FROM tenx Thorper 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.