Koleksi Query: Difference between revisions
From OnnoCenterWiki
Jump to navigationJump to search
Gibransyah (talk | contribs) New page: = Date/Time = * Hitung penjualan tahunan dikelompokkan per bulan dan per minggu (#mysql) SELECT YEAR( tglTransaksiJual ) AS tahun, MONTH( tglTransaksiJual ) AS bulan, WEEK( tglTrans... |
Gibransyah (talk | contribs) No edit summary |
||
| Line 9: | Line 9: | ||
GROUP BY | GROUP BY | ||
tahun, bulan, minggu | tahun, bulan, minggu | ||
Ref http://think-robot.com/2009/04/week-of-the-month-in-mysql/ | |||
Revision as of 04:11, 13 June 2012
Date/Time
- Hitung penjualan tahunan dikelompokkan per bulan dan per minggu (#mysql)
SELECT YEAR( tglTransaksiJual ) AS tahun, MONTH( tglTransaksiJual ) AS bulan, WEEK( tglTransaksiJual, 5 ) - WEEK( DATE_SUB( tglTransaksiJual, INTERVAL DAYOFMONTH( tglTransaksiJual ) - 1 DAY ) , 5 ) +1 AS minggu, SUM( uangDibayar ) AS total_sales FROM transaksijual GROUP BY tahun, bulan, minggu
Ref http://think-robot.com/2009/04/week-of-the-month-in-mysql/