0

I would like to create a mySQL query that outputs data in the following form:

Date       | # of small | # of null | # of other
2014-06-05 | 5          | 7         | 3
2014-06-04 | 3          | 21        | 4
2014-06-03 | 2          | 13        | 7
.
.
.

That is, I know how to calculate the right three columns, but how do I create the left-most column?

Also, I want a query; I don't want to create a table, since I don't have permissions in this database.

Thanks!

brandonCabi
  • 311
  • 3
  • 2
  • What is the data you are starting with? Please edit your question and show the query that produces the other three columns. – Gordon Linoff Jun 06 '14 at 00:57
  • mysql doesn't have a function to generate a series - the easiest way is to populate a table with all the dates you'll (ever) need and join to that – Bohemian Jun 06 '14 at 00:58
  • 1
    The query *may* be sufficiently answered with a mere GROUP BY (if gaps for no-items can be ignored).. – user2864740 Jun 06 '14 at 00:58
  • @Barmar . . . I disagree with this being a duplicate because the OP has not provided enough information. The sample data and question make no reference to filling in days with no data. Until the OP responds, though, I'm leaving the question closed. – Gordon Linoff Jun 06 '14 at 01:08
  • @GordonLinoff That's how I interpreted "iterated date column". – Barmar Jun 06 '14 at 01:12
  • I figured out that the data already had the date values (as datetimes), and all I had to do was bubble the dates to the top of the query, apply the date() function, and then GROUP BY date(created_tx_stamp). Thank y'all for your time. Should I try to delete this question? – brandonCabi Jun 06 '14 at 01:28

0 Answers0