Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 19th, 2010 | Syntax: MySQL | Size: 0.95 KB | Hits: 65 | Expires: Never
Copy text to clipboard
  1. select download_date, download_platform, download_total from
  2.  /*This is to fix the empty platform values*/
  3. (select DATE_FORMAT(date(FROM_UNIXTIME(ds_timestamp)), '%Y/%m/%d') as download_date, ds_client_platform download_platform, count(*) download_total
  4.         from downloadportal.dr_download_statistics
  5.         where length(ds_client_platform) > 0 and (date(FROM_UNIXTIME(ds_timestamp)) between $P{from_date} and $P{to_date})
  6.         and (ds_is_update = $P{update})
  7.         group by download_date, ds_client_platform
  8.  union
  9.  select DATE_FORMAT(date(FROM_UNIXTIME(ds_timestamp)), '%Y/%m/%d') as download_date, 'Unknown' download_platform, count(*) download_total
  10.         from downloadportal.dr_download_statistics
  11.         where length(ds_client_platform) = 0 and (date(FROM_UNIXTIME(ds_timestamp)) between $P{from_date} and $P{to_date})
  12.         and (ds_is_update = $P{update})
  13.         group by download_date, ds_client_platform) as platform_download_stats
  14. order by download_date, download_platform