Postingan lainnya
Buat kolom waktu baru tanpa menggunakan fungsi MAX / SUM
Saya ingin merubah format table untuk keperluan view di web application.
Berikut tabel yang saya punya :
1.PNG
Saya ingin menjadi seperti ini :
2.PNG
2 Jawaban:
<div>Sepertinya ini bukan untuk keperluan nyata ya.<br><figure data-trix-attachment="{"contentType":"image/png","filename":"sk_rifkitr_google__pivot.png","filesize":28860,"height":839,"url":"https://i.ibb.co/qxq0DFG/sk-rifkitr-google-pivot.png","width":782}" data-trix-content-type="image/png" data-trix-attributes="{"presentation":"gallery"}" class="attachment attachment--preview attachment--png"><img src="https://i.ibb.co/qxq0DFG/sk-rifkitr-google-pivot.png" width="782" height="839"><figcaption class="attachment__caption"><span class="attachment__name">sk_rifkitr_google__pivot.png</span></figcaption></figure><br>Sorry soal bukan untuk keperluan nyata; dengan melimit penggunaan window-function akan berdampak pada cost-query-nya.<br>update query-nya, ada kemungkinan data NULL-nya itu NULL bukan string "NULL"<br><figure data-trix-attachment="{"contentType":"image/png","filename":"sk_rifkitr_google__pivot_query.png","filesize":377930,"height":2388,"url":"https://i.ibb.co/FzBj6g9/sk-rifkitr-google-pivot-query.png","width":1294}" data-trix-content-type="image/png" data-trix-attributes="{"presentation":"gallery"}" class="attachment attachment--preview attachment--png"><img src="https://i.ibb.co/FzBj6g9/sk-rifkitr-google-pivot-query.png" width="1294" height="2388"><figcaption class="attachment__caption"><span class="attachment__name">sk_rifkitr_google__pivot_query.png</span></figcaption></figure><br><br>Coba lihat hasil test di <a href="http://sqlfiddle.com/#!9/b1316a/5">SQLFiddler</a>.<br><figure data-trix-attachment="{"contentType":"image/png","filename":"sk_rifkitr_google__pivot_query_2.png","filesize":490631,"height":2308,"url":"https://i.ibb.co/tbkHfrB/sk-rifkitr-google-pivot-query-2.png","width":1134}" data-trix-content-type="image/png" data-trix-attributes="{"presentation":"gallery"}" class="attachment attachment--preview attachment--png"><img src="https://i.ibb.co/tbkHfrB/sk-rifkitr-google-pivot-query-2.png" width="1134" height="2308"><figcaption class="attachment__caption"><span class="attachment__name">sk_rifkitr_google__pivot_query_2.png</span></figcaption></figure><br><br></div>
Tanggapan
Di saya masih salah urutannya gan, agan pake SQL Server ya? sy pke MySQL di Phpmyadmin
Untuk test ini pakai MySQL 8.
<div>ini untuk keperluan nyata Pak @soeleman<br>dr kmrn saya sdh query sesuai denga itu tp hasilnya agak beda dari urutannya<br><figure data-trix-attachment="{"contentType":"image/png","filename":"image.png","filesize":15955,"height":349,"url":"https://i.ibb.co/F5g1hGy/image.png","width":241}" data-trix-content-type="image/png" data-trix-attributes="{"presentation":"gallery"}" class="attachment attachment--preview attachment--png"><img src="https://i.ibb.co/F5g1hGy/image.png" width="241" height="349"><figcaption class="attachment__caption"><span class="attachment__name">image.png</span></figcaption></figure></div>
Tanggapan
update jawaban diatas