1. skip to Navigation
  2. skip to Content

Main navigation




2006 Oct 5

MySQL: ‘UNION’ command

Posted under
: work
Tagged with
: ,

Only 1 comment/pingback has been made so far – add yours?

Kemaren ada kerjaan yang make command ini…mungkin uda banyak yang tau…tapi sekedar sharing aja.

UNION command di MySQL digunakan untuk melakukan SELECT pada dua atau lebih tabel. contohnya :

  1. SELECT * FROM tabel_1 UNION SELECT * FROM tabel_2;

Atau dengan contoh yang sedikit lebih kompleks, misalnya memakai kondisi tertentu dan digunakan untuk paging :

  1. SELECT * FROM tabel_1 WHERE cat_id=’$id’ UNION SELECT * FROM tabel_2 ORDER BY nama LIMIT $offset, $rowsPerPage;

Command UNION ini hanya digunakan pada dua atau lebih tabel yang memiliki struktur kolom yang sama.

*sharing yang tida berguna..ahushuhsuhsuhashushush

  • Comments so far
  1. *angkat tangan… sambil bilang… gak ngerrtiii paaakkkk…

    deon October 13, 2006 — 9:11 am

Have a say *) required fields


Photostream

  • 037/365: Mojok
  • 036/365: Another day another meetup
  • 035/365: Meeting & working on Saturday
  • 034/365: Always have problem with wires
  • 033/365
  • 032/365: Childhood dream

Recently listening to

  • Coldplay - Speed Of Sound
  • Coldplay - Fix You
  • Coldplay - Swallowed in the Sea
  • Röyksopp - Eple
  • Röyksopp - Remind Me (Live)
  • Red Hot Chili Peppers - Gong Li