Zend如何使用自己的表字段值更新表值

时间:2012-07-13 08:30:08

标签: zend-framework zend-db-table

如何在Zend DB Table上执行此操作?像,

UPDATE location AS main
  SET main.parent_location = 28, 
  main.description = CONCAT(
          (SELECT sub.description FROM wms_location AS sub WHERE sub.id_location=28), 
           main.designation
      ) 
WHERE main.id_location in (11, 14);

这甚至可能吗?

1 个答案:

答案 0 :(得分:1)

$table->update(
    "parent_location" => new Zend_Db_Expr(
        "CONCAT(" . (string)$subSelect . ", designation)"
    ),
    "id_location IN(11, 14)"
);

我不确定别名 - 它们是否可能以及是否需要它们。