Welcome to Abdul Malik Ikhsan's Blog

SubQuery pada Zend_Db_Select

Posted in tips and tricks, Tutorial PHP by samsonasik on October 30, 2009

Anggaplah kita akan menjalankan query seperti berikut :

select is_add from dwt_menushow where menu_id = any(select menu_id
from dwt_menu where menu_link = 'mfirst') and groupuser_id = 1

Maka yang harus kita lakukan adalah mengkonversi penggunaan Zend_Db_Select pada subquery menjadi String.

$exp = $this->db->select()->from($this->prefixDbDefault."menu",
 ->where("menu_link = 'mfirst' ")

Setelah itu, baru kita panggil :

$select = $this->db->select()->
 ->where("menu_id = any( $exp ) and groupuser_id = 1 ");

//cek ...
echo "<pre>";
echo "</pre>"

Referensi : http://old.nabble.com/

Tagged with:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: