MySQL Forums
Forum List  »  MySQL Query Browser

how to format following query
Posted by: Prashant Patel
Date: April 26, 2016 01:07PM

how to format following query:

labuser001@lab00505:/home/labuser001# mysql -u labuser001 -h 10.10.10.05 -plab005 cloud -e "select now() as 'form', now() - INTERVAL 1 DAY as 'to',status, count(*) from lab_table1 where lab_account_id=10 and lab_table1.created >= now() - INTERVAL 1 DAY GROUP BY status"
+---------------------+---------------------+------------+----------+
| form | to | status | count(*) |
+---------------------+---------------------+------------+----------+
| 2016-04-26 14:30:19 | 2016-04-25 14:30:19 | Pending | 22 |
| 2016-04-26 14:30:19 | 2016-04-25 14:30:19 | Started | 573 |
| 2016-04-26 14:30:19 | 2016-04-25 14:30:19 | Final | 31 |
| 2016-04-26 14:30:19 | 2016-04-25 14:30:19 | Incomplete | 1 |
| 2016-04-26 14:30:19 | 2016-04-25 14:30:19 | Error | 1 |
+---------------------+---------------------+------------+----------+
labuser001@lab00505:/home/labuser001#


to make it look like:

from:2016-04-26 14:30:19
to:2016-04-25 14:30:19
+------------+----------+
| status | count(*) |
+------------+----------+
| Pending | 22 |
| Started | 573 |
| Final | 31 |
| Incomplete | 1 |
| Error | 1 |
+------------+----------+

Options: ReplyQuote


Subject
Written By
Posted
how to format following query
April 26, 2016 01:07PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.