Zend Framework – Zend_Db_Selectのメモ

マニュアル

例 10.44. 流暢なインターフェイスの使用例

[php]
$select = $db->select()
->from( …テーブルとカラムを指定します… )
->where( …検索条件を指定します… )
->order( …ソート条件を指定します… );
[/php]

joinとかは
[php]
// できあがるクエリは、このようになります
// SELECT p."product_id", p."product_name", l.*
// FROM "products" AS p JOIN "line_items" AS l
// ON p.product_id = l.product_id
$select = $db->select()
->from(array(‘p’ => ‘products’),
array(‘product_id’, ‘product_name’))
->join(array(‘l’ => ‘line_items’),
‘p.product_id = l.product_id’);
[/php]

で。JOIN LEFTは
[php]
joinLeft(table, condition, [columns])
[/php]

こんな感じ。メモメモ。

関連する記事:

Powered by

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">