$select = $db->select()
->from('products',
array('product_id', 'product_name', 'price'));
당신이에서() 메서드의 두 번째 인수로 원하는 fiels을 통과해야), 첫 번째 테이블은 . 일반적인 SQL 구문에서는 원하는 필드가 먼저 나오기 때문에 혼란 스럽지만 zend db는 모듈 방식으로 쿼리를 작성하려는 경우 매우 유용합니다.
Example #11 Examples of adding columns with the columns() method
// Build this query:
// SELECT p."product_id", p."product_name"
// FROM "products" AS p
$select = $db->select()
->from(array('p' => 'products'), 'product_id')
->columns('product_name');
// Build the same query, specifying correlation names:
// SELECT p."product_id", p."product_name"
// FROM "products" AS p
$select = $db->select()
->from(array('p' => 'products'), 'p.product_id')
->columns('product_name', 'p');
// Alternatively use columns('p.product_name')
감사 : 문자열과 단일 문자열의 배열
또 다른 예
을 수락! ;) 나는 메일로 그 케이크를 보낼 것이라고 생각한다. – baklap당신은 더 빨랐습니다 :) –