久久久久久久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 上構(gòu)建嵌套選擇

        how to build nested select on zend db(如何在 zend db 上構(gòu)建嵌套選擇)
        • <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 上構(gòu)建嵌套選擇的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  這個(gè)查詢有問(wèn)題

                  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`
                  

                  如何將其轉(zhuǎn)換為 Zend_Db_Select 對(duì)象?

                  how can i convert this in to Zend_Db_Select object?

                  主要問(wèn)題是這部分

                  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 對(duì)象在您的查詢和 選擇 AS 的數(shù)組結(jié)構(gòu).

                  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));
                  

                  這篇關(guān)于如何在 zend db 上構(gòu)建嵌套選擇的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產(chǎn)品、類別和元數(shù)據(jù)的 SQL 查詢 woocommerce/wordpress)
                  Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數(shù)據(jù)庫(kù)列表和 SQL Server 實(shí)例使用的空間嗎?) - IT屋-程序員軟件開發(fā)
                  How to create a login to a SQL Server instance?(如何創(chuàng)建對(duì) SQL Server 實(shí)例的登錄?)
                  How to know the version and edition of SQL Server through registry search(如何通過(guò)注冊(cè)表搜索知道SQL Server的版本和版本)
                  Why do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(為什么會(huì)出現(xiàn)“數(shù)據(jù)類型轉(zhuǎn)換錯(cuò)誤?使用 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'>

                            主站蜘蛛池模板: 操久久| 国产三级精品三级在线观看四季网 | 不卡一区二区三区四区 | 国产欧美精品一区 | 国内精品久久精品 | 久精品久久| 欧美另类视频 | 亚洲综合二区 | 9191在线观看 | 欧美精品一区三区 | 国产在线一区二区三区 | 久久精品69 | 一区精品视频在线观看 | 欧美日韩一 | 一区二区三区视频在线免费观看 | 久久精品一区二区三区四区 | h视频在线免费观看 | yiren22 亚洲综合 | 精品久久久久国产 | 亚州av在线 | 91久久国产综合久久91精品网站 | 91视视频在线观看入口直接观看 | 欧美成人一区二区 | 久久国产亚洲 | 日韩在线综合 | 亚洲一区二区久久久 | 精品一区二区三区入口 | 日韩欧美在线一区 | 久久国产视频播放 | 日韩精品免费一区二区在线观看 | 综合久久综合久久 | 91精品国产91久久综合桃花 | 亚洲视频在线看 | 国产精品美女久久久久久免费 | 欧洲精品在线观看 | 龙珠z国语版在线观看 | 日韩免费一二三区 | 久久国产高清视频 | 国产精品高潮呻吟久久av黑人 | 一级片子 | 天天综合网永久 |