久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <small id='12m7A'></small><noframes id='12m7A'>

        <bdo id='12m7A'></bdo><ul id='12m7A'></ul>
    1. <legend id='12m7A'><style id='12m7A'><dir id='12m7A'><q id='12m7A'></q></dir></style></legend>
        <tfoot id='12m7A'></tfoot>

        <i id='12m7A'><tr id='12m7A'><dt id='12m7A'><q id='12m7A'><span id='12m7A'><b id='12m7A'><form id='12m7A'><ins id='12m7A'></ins><ul id='12m7A'></ul><sub id='12m7A'></sub></form><legend id='12m7A'></legend><bdo id='12m7A'><pre id='12m7A'><center id='12m7A'></center></pre></bdo></b><th id='12m7A'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='12m7A'><tfoot id='12m7A'></tfoot><dl id='12m7A'><fieldset id='12m7A'></fieldset></dl></div>
      1. 如何在 zend db 上構建嵌套選擇

        how to build nested select on zend db(如何在 zend db 上構建嵌套選擇)
        • <bdo id='WnbkY'></bdo><ul id='WnbkY'></ul>

            <i id='WnbkY'><tr id='WnbkY'><dt id='WnbkY'><q id='WnbkY'><span id='WnbkY'><b id='WnbkY'><form id='WnbkY'><ins id='WnbkY'></ins><ul id='WnbkY'></ul><sub id='WnbkY'></sub></form><legend id='WnbkY'></legend><bdo id='WnbkY'><pre id='WnbkY'><center id='WnbkY'></center></pre></bdo></b><th id='WnbkY'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='WnbkY'><tfoot id='WnbkY'></tfoot><dl id='WnbkY'><fieldset id='WnbkY'></fieldset></dl></div>

                <tbody id='WnbkY'></tbody>
              <tfoot id='WnbkY'></tfoot>

              <legend id='WnbkY'><style id='WnbkY'><dir id='WnbkY'><q id='WnbkY'></q></dir></style></legend>

              • <small id='WnbkY'></small><noframes id='WnbkY'>

                1. 本文介紹了如何在 zend db 上構建嵌套選擇的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  這個查詢有問題

                  SELECT * FROM(
                      SELECT `b`.*,`owner`.firstname,`owner`.lastname,`owner`.email,
                      (
                          SELECT COUNT(`ps`.profile_id)   FROM `profile` AS `ps`
                          LEFT JOIN `xref_store_profile_brand` AS `xbp` ON `xbp`.profile_id = `ps`.profile_id
                          WHERE `xbp`.brand_id = b.brand_id AND ps.role = 'salesrep' AND `xbp`.store_id IS NULL
                      ) AS `salesrepTotal`,
                      (
                          SELECT GROUP_CONCAT(`ms`.firstname)   FROM `profile` AS `ps`
                          LEFT JOIN `xref_store_profile_brand` AS `xbp` ON `xbp`.profile_id = `ps`.profile_id
                          LEFT JOIN `member` AS `ms`ON `ms`.member_id = `ps`.member_id
                          WHERE `xbp`.brand_id = `b`.brand_id AND ps.role = 'salesrep' AND `xbp`.store_id IS NULL
                      ) AS `salesrep`,
                      (
                          SELECT COUNT(`s`.store_id) FROM `store` AS `s`
                          LEFT JOIN `xref_store_profile_brand` AS `xbs` ON `xbs`.store_id = `s`.store_id
                          WHERE `xbs`.brand_id = `b`.brand_id AND `xbs`.brand_id IS NOT NULL
                      ) AS `storeTotal`,
                      (
                          SELECT GROUP_CONCAT(`s`.name) FROM `store` AS `s`
                          LEFT JOIN `xref_store_profile_brand` AS `xbs` ON `xbs`.store_id = `s`.store_id
                          WHERE `xbs`.brand_id = `b`.brand_id AND `xbs`.brand_id IS NOT NULL
                      ) AS `store`
                  
                      FROM `brand` AS `b`
                      LEFT JOIN
                      (
                          SELECT `m`.firstname,`m`.lastname,`m`.email,`xspb`.brand_id FROM `member` AS `m`
                          LEFT JOIN `profile` as `p` ON `p`.member_id = `m`.member_id AND `p`.role = 'designer' AND `p`.isPrimary = 1
                          LEFT JOIN `xref_store_profile_brand` AS `xspb` ON `xspb`.profile_id = `p`.profile_id AND `xspb`.store_id IS NULL
                      ) AS `owner` ON `owner`.brand_id =`b`.brand_id
                  
                      GROUP BY `b`.brand_id
                  ) AS `final`
                  

                  如何將其轉換為 Zend_Db_Select 對象?

                  how can i convert this in to Zend_Db_Select object?

                  主要問題是這部分

                  SELECT `b`.*,`owner`.firstname,`owner`.lastname,`owner`.email,
                      (
                          SELECT COUNT(`ps`.profile_id)   FROM `profile` AS `ps`
                          LEFT JOIN `xref_store_profile_brand` AS `xbp` ON `xbp`.profile_id = `ps`.profile_id
                          WHERE `xbp`.brand_id = b.brand_id AND ps.role = 'salesrep' AND `xbp`.store_id IS NULL
                      ) AS `salesrepTotal`,
                  

                  推薦答案

                  您需要使用 Zend_Db_Expr 對象在您的查詢和 選擇 AS 的數組結構.

                  You need to use Zend_Db_Expr objects in your query and array structures for select AS.

                  以下是您正在尋找的解決方案:

                  below is the solution you are looking for:

                  <?php
                  
                  $db = Zend_Db_Table::getDefaultAdapter();
                  
                  //  inner query
                  $sqlSalesRepTotal = $db->select()
                          ->from(array('ps' => 'profile'))
                          ->joinLeft(array('xbp' => 'xref_store_profile_brand'), 'xbp.profile_id = ps.profile_id')
                          ->where('xbp.brand_id = b.brand_id')
                          ->where('ps.role = ?', 'salesrep')
                          ->where('xbp.store_id IS NULL');
                  
                  //  main query
                  $sql = $db->select()
                          ->from(array('b' => 'brand'), array(
                              //  NOTE: have to add parentesis around the expression
                              'salesrepTotal' => new Zend_Db_Expr("($sqlSalesRepTotal)")
                          ))
                          ->where('....')
                          ->group('brand_id');
                  
                  
                  //  debug
                  var_dump($db->fetchAll($sql));
                  

                  這篇關于如何在 zend db 上構建嵌套選擇的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產品、類別和元數據的 SQL 查詢 woocommerce/wordpress)
                  Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數據庫列表和 SQL Server 實例使用的空間嗎?) - IT屋-程序員軟件開發
                  How to create a login to a SQL Server instance?(如何創建對 SQL Server 實例的登錄?)
                  How to know the version and edition of SQL Server through registry search(如何通過注冊表搜索知道SQL Server的版本和版本)
                  Why do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(為什么會出現“數據類型轉換錯誤?使用 ExecuteNonQuery()?)
                  How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)
                    • <tfoot id='FPPQV'></tfoot>

                        <i id='FPPQV'><tr id='FPPQV'><dt id='FPPQV'><q id='FPPQV'><span id='FPPQV'><b id='FPPQV'><form id='FPPQV'><ins id='FPPQV'></ins><ul id='FPPQV'></ul><sub id='FPPQV'></sub></form><legend id='FPPQV'></legend><bdo id='FPPQV'><pre id='FPPQV'><center id='FPPQV'></center></pre></bdo></b><th id='FPPQV'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FPPQV'><tfoot id='FPPQV'></tfoot><dl id='FPPQV'><fieldset id='FPPQV'></fieldset></dl></div>

                      1. <legend id='FPPQV'><style id='FPPQV'><dir id='FPPQV'><q id='FPPQV'></q></dir></style></legend>
                          <tbody id='FPPQV'></tbody>
                          <bdo id='FPPQV'></bdo><ul id='FPPQV'></ul>

                            <small id='FPPQV'></small><noframes id='FPPQV'>

                            主站蜘蛛池模板: 国产成人免费在线 | 超碰日韩| 女人毛片a毛片久久人人 | 欧美操操操 | 久久国产精品一区二区三区 | 欧美人妇做爰xxxⅹ性高电影 | 午夜电影福利 | 亚洲视频免费播放 | 中文字幕在线精品 | 国产精品一区二区久久 | 中文字幕在线看 | 91久久国产综合久久 | 一区二区三区国产 | 日本精品一区二区三区四区 | 久久一级大片 | 亚洲 欧美 日韩 精品 | www中文字幕| 在线成人 | 亚洲午夜av久久乱码 | 国产高潮好爽受不了了夜夜做 | 日韩高清电影 | 日韩av成人 | 精品一区国产 | 亚洲免费精品一区 | 91视频在线看 | 影音先锋欧美资源 | 365夜爽爽欧美性午夜免费视频 | 黑人巨大精品欧美一区二区一视频 | 97国产精品视频 | 丁香五月网久久综合 | 久久午夜国产精品www忘忧草 | 久久a久久 | 亚洲二区视频 | 中文字幕日本一区二区 | 国产精品视频久久 | 国产激情视频网站 | 亚洲精品乱码久久久久久9色 | 一级黄色毛片a | 日韩精品在线视频 | 久久伦理中文字幕 | h片免费看|