newb Posted August 9, 2010 Share Posted August 9, 2010 SELECT *,from_unixtime(date,'%Y-%m%-%d') as date1 FROM items WHERE disabled != 1 GROUP BY cat_id WHERE date1 = DATE_SUB(curdate(), INTERVAL 1 DAY) ORDER BY date desc not working? why? Quote Link to comment Share on other sites More sharing options...
msaz87 Posted August 9, 2010 Share Posted August 9, 2010 Are you getting any kind of error? Is it just not producing any results? One way to check it would be to echo the query to check if everything is feeding into it right: $query = "SELECT *,from_unixtime(date,'%Y-%m%-%d') as date1 FROM items WHERE disabled != 1 GROUP BY cat_id WHERE date1 = DATE_SUB(curdate(), INTERVAL 1 DAY) ORDER BY date desc"; Quote Link to comment Share on other sites More sharing options...
Maq Posted August 9, 2010 Share Posted August 9, 2010 How is it not working? Quote Link to comment Share on other sites More sharing options...
fenway Posted August 10, 2010 Share Posted August 10, 2010 not working? why? First, don't use all caps. Second, try actually checking the error. Third, consult the refman for proper select syntax -- you can't put the where clause after GROUP BY. 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.