I want to ask about SQL Server 2005 about date grouping with other sum field.
| tanggal | nama | qty |
|---------------------|-------------------------|------|
| 2017-07-11 06:25:00 | APEL | 4.00 |
| 2017-07-11 06:25:00 | SUSU KENTAL MANIS PUTIH | 4.00 |
| 2017-07-11 06:29:00 | APEL | 4.00 |
| 2017-07-11 06:29:00 | SUSU KENTAL MANIS PUTIH | 4.00 |
| 2017-07-10 06:29:00 | APEL | 2.00 |
| 2017-07-10 06:29:00 | SUSU KENTAL MANIS PUTIH | 2.00 |
| 2017-07-11 00:00:00 | APEL | 1.00 |
| 2017-07-11 00:00:00 | SUSU KENTAL MANIS PUTIH | 1.00 |
and I need result like this
| Tanggal | Barang | Jumlah |
|------------|-------------------------|--------|
| 2017-07-10 | APEL | 2.00 |
| 2017-07-10 | SUSU KENTAL MANIS PUTIH | 2.00 |
| 2017-07-11 | APEL | 9.00 |
| 2017-07-11 | SUSU KENTAL MANIS PUTIH | 9.00 |
Here's the code
select j.tanggal [Tanggal],p.nama [Barang],sum(p.qty) [Jumlah]
from proses p
left join jual j on j.kode=p.kode
group by j.tanggal,p.kodeItem,p.nama,p.unit,p.kode