Mohon Bantuannya Gabungin Perintah SQL

Discussion in 'Desain Web dan Programming' started by Pencari_Ilmu, 13 Aug 2015.

Thread Status:
Not open for further replies.
  1. Pencari_Ilmu

    Pencari_Ilmu Expert 2.0

    Messages:
    825
    Likes Received:
    109
    Trophy Points:
    43
    Dear tuan,
    Kebetulan lagi utak atik database mysql, gimana cara menjalankan 3 perintah sql ini biar lebih praktis saat dijalankan (tdk harus satu-persatu):

    UPDATE wp_posts SET post_content = REPLACE (
    post_content,
    ' tgl.',
    ' tanggal.');

    UPDATE wp_posts SET post_content = REPLACE (
    post_content,
    ' hr.',
    ' hari.');

    UPDATE wp_posts SET post_content = REPLACE (
    post_content,
    ' thn.',
    ' tahun.');

    Mohon bantuannya..
     
  2. masiqbal

    masiqbal Expert 2.0

    Messages:
    862
    Likes Received:
    249
    Trophy Points:
    43
    Kalau gini bisa gak?

    UPDATE wp_posts SET post_content = REPLACE (
    REPLACE(
    REPLACE(
    post_content,
    ' tgl.',
    ' tanggal.'),
    ' hr.',
    ' hari.'),
    ' thn.',
    ' tahun.');
     
    Pencari_Ilmu likes this.
  3. junior riau

    junior riau Hosting Guru Web Hosting

    Messages:
    3,227
    Likes Received:
    514
    Trophy Points:
    113
    harusnya masukin ke 3 query itu udah bisa kok
    kan ada semicolon pemisah querynya;
     
    Pencari_Ilmu likes this.
  4. Pencari_Ilmu

    Pencari_Ilmu Expert 2.0

    Messages:
    825
    Likes Received:
    109
    Trophy Points:
    43
    Saya sudah mencoba tipsnya dan berhasil, thanks pak :)
     
  5. dpnux

    dpnux Expert 1.0

    Messages:
    455
    Likes Received:
    28
    Trophy Points:
    28
    Jangan lupa untuk mengklik best answer Om @Pencari_Ilmu untuk jawaban yang sesuai. Saling mengisi :)
     
    Pencari_Ilmu likes this.
  6. junior riau

    junior riau Hosting Guru Web Hosting

    Messages:
    3,227
    Likes Received:
    514
    Trophy Points:
    113
    sama sama pak
    kalau via mysql interface bisa run banyak, dengan semi colon sebagai pemisah antar query,
    kalau via codephp, itu yang bisa via pdo dan mysqli
     
  7. Pencari_Ilmu

    Pencari_Ilmu Expert 2.0

    Messages:
    825
    Likes Received:
    109
    Trophy Points:
    43
    Ups, maaf lupa...tombol sudah dipencet :)

    iya kebetulan pakai phpmyadmin nih, thanks ilmunya karena sempat ragu kalau keliru takutnya bisa berefek ke databasenya :)
     
  8. junior riau

    junior riau Hosting Guru Web Hosting

    Messages:
    3,227
    Likes Received:
    514
    Trophy Points:
    113
    sama sama pak :D
     
Loading...
Thread Status:
Not open for further replies.

Share This Page

Loading...