I’m trying to fetch a number of rows from a MySQL database and group them by the day they were posted.
End result I would like the following..
Monday
-Article 1
-Article 2
-Article 3
Tuesday
-Article 1
-Article 2
Wednesday
-Article 1
-Article 2
-Article 3
-Article 4
And so on, I’m not sure if this can be done in MySQL alone without PHP doing extra work.
This is the query I have so far but doesn’t seem to group by day.
SELECT
cms_news.news_id,
cms_news.news_title,
cms_news.news_date,
cms_news.news_category,
cms_news.news_source,
cms_news.news_type,
cms_news.news_content
FROM
cms_news cms_news,
GROUP BY
DAYOFMONTH(FROM_UNIXTIME(cms_news.news_date))
ORDER BY
cms_news.news_date DESC
Thanks.
Incoming search terms:
- how to run aggregate function in php in codeigniter
- mysql regrouper timestamp par jour
- python group by timestamp
- unix timestamp mysql
Related posts:
- Unix timestamp VS datetime I have a Mysql table, which has a column add_date. It tracks the date/time when...
- CakePHP: No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) I have had a cakephp app running fine on my local machine (mac osx) for...
- Why do PHP and MySQL unix timestamps diverge on 1983-10-29? I’ve been using PHP’s strtotime and MySQL’s UNIX_TIMESTAMP functions in my app, to convert dates...
- UNIX timestamp always in GMT? UNIX timestamp always in GMT? I tried to run php function time() and when I...
- How do I add 24 hours to a unix timestamp in php? I would like to add 24 hours to the timestamp for now. How do I...
- Check whether the string is a unix timestamp I have a string and I need to find out whether it is a unix...
- Compare group of tags to find similarity/score with PHP/MySQL My Question is, how do I compare a group of tags to another posts tags...
- How do I manage development and deployment of my website as part of a group? I’ve been reading this site here and there and appears as though you guys have...
- Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in I’m trying to connect to my MySQL DB with the Terminal on my Apple (With...
- How many MySQL queries should I limit myself to on a page? PHP / MySQL Okay, so im sure plenty of you have built crazy database intensive pages… I am...






0