1

我正在尝试使用 Zend Framework 构建 SQL 查询。这是我的 SQL 查询语句:

    SELECT of.order_Id, of.subtotal, of.status, c.name
    FROM order_form of, customer c
    WHERE c.customer_Id = of.customer_Id

但是,当我尝试在 Zend Framework 中实现它时,会显示一条错误消息。这是我使用 Zend Framework 的查询语句。

$query = $db->select()
            ->from(array('c' => 'customer'), 'name')
            ->where('c.customer_Id = ?', $customer_Id)
            ->join('order_form', 'order_form.customer_Id = customer.customer_Id', array('order_Id', 'subtotal', 'status'))
            ->order("order_form.order_Id ASC");
4

1 回答 1

0

我的部分有错误。只需在子句中更改customer.customer_Idc.customer_Idjoin

$query = $db->select()
            ->from(array('c' => 'customer'), 'name')
            ->where('c.customer_Id = ?', $customer_Id)
            ->join('order_form', 'order_form.customer_Id = c.customer_Id', array('order_Id', 'subtotal', 'status'))
            ->order("order_form.order_Id ASC");

给您造成的任何不便,请原谅。

于 2013-02-09T15:29:26.807 回答