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

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

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

      • <bdo id='iFlty'></bdo><ul id='iFlty'></ul>
    2. <legend id='iFlty'><style id='iFlty'><dir id='iFlty'><q id='iFlty'></q></dir></style></legend>

      MySQL查詢以根據自定義列名和值獲取值

      MySQL query to get values based on custom column name and values(MySQL查詢以根據自定義列名和值獲取值)
      <tfoot id='Do2HV'></tfoot>

          <tbody id='Do2HV'></tbody>
          <bdo id='Do2HV'></bdo><ul id='Do2HV'></ul>

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

              1. <legend id='Do2HV'><style id='Do2HV'><dir id='Do2HV'><q id='Do2HV'></q></dir></style></legend>
                本文介紹了MySQL查詢以根據自定義列名和值獲取值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我有兩張這樣的桌子

                    wp_posts
                
                  ID   post_date      post_title   post_type   post_status
                  1    2020-12-10      ABC         institute   publish
                  2    2020-12-16      DEG         institute   publish
                  3    2020-12-11      XXY         institute   publish
                  4    2020-12-12      ABX         institute   publish
                  5    2020-12-24      ZYU         institute   publish
                  6    2020-12-28      ANM         institute   publish
                  7    2020-12-16      DDK         institute   publish
                  8    2020-12-30      LKI         institute   publish
                  9    2020-12-30      LKI         institute   publish
                  10   2020-12-31      LKI         institute   publish
                  11   2020-12-16      TGY         institute   publish
                  12   2020-12-16      MUN         institute   publish
                
                 wp_postmeta
                
                meta_id  post_id   meta_key         meta_value
                1          1       country_id           10
                2          1       registartion_by      online
                3          3       registartion_by      offline
                4          4       country_id           100
                5          3       country_id           100
                6          4       registartion_by      online
                7          5       registartion_by      online
                8          7       registartion_by      offline
                9          7       country_id           101
                10         5       country_id           102
                11         8       country_id           103
                12         9       registartion_by      online
                13         8       registartion_by      offline
                14         9       country_id           10
                15         10      country_id           104
                16         10      registartion_by      offline
                17         11      country_id           101
                18         11      registartion_by      online
                

                現在我想進行一些查詢,以便最終輸出應該像這樣顯示

                Now I want to make some query so that the final output should be shown something like this

                Date            Country   Offline_registration  Online_registartion
                2020-12-10      10          0                      1
                2020-12-11      100         1                      0
                2020-12-12      100         0                      1
                2020-12-16      101         1                      1
                2020-12-24      102         0                      1
                2020-12-30      103         0                      1
                2020-12-31      104         1                      0
                

                所以為了實現這一點,我做了一些這樣的查詢

                So to achieve this I have made some query like this

                SELECT date( posts.post_date ) as Date , postmeta.meta_value as Country
                  FROM wp_posts as posts INNER JOIN wp_postmeta as postmeta on posts.ID = postmeta.post_id WHERE posts.post_type = 'institute' AND posts.post_status = 'publish' AND postmeta.meta_key = 'country_id' GROUP BY postmeta.meta_value
                

                但是我無法獲取注冊類型計數的數據,即(在線/離線注冊).那么有人可以告訴我如何實現這一目標嗎?

                But I can't get data of registration type count i.e(online/offline registration). So can someone tell me how to achieve that?

                任何建議或建議都非常值得贊賞.謝謝.

                Any suggestions or advice would be really appreciable. Thanks.

                推薦答案

                您可以通過加入 wp_postmeta 兩次來做到這一點,一次針對國家/地區,一次針對注冊:

                You can do this by joining to wp_postmeta twice, once for the country and once for the registrations:

                SELECT date(p.post_date) as Date, pmc.meta_value as Country,
                       SUM( pmr.meta_value = 'online' ) as num_online,
                       SUM( pmr.meta_value = 'offline' ) as num_offline
                 FROM wp_posts p INNER JOIN
                      wp_postmeta pmc 
                      ON pmc.post_id = p.id AND
                         pmc.meta_key = 'country_id' LEFT JOIN
                      wp_postmeta pmr
                      ON pmc.post_id = p.id AND
                         pmc.meta_key = 'registion_by' 
                WHERE p.post_type = 'institute' AND
                      p.post_status = 'publish'
                GROUP BY date, country;
                

                這篇關于MySQL查詢以根據自定義列名和值獲取值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)

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

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

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

                          <bdo id='b3vj8'></bdo><ul id='b3vj8'></ul>
                          主站蜘蛛池模板: 国产伦一区二区三区 | 一区二区三区四区在线视频 | 国产精品日韩欧美一区二区三区 | 亚洲日韩中文字幕 | 久久日韩精品一区二区三区 | 国产福利视频网站 | 午夜小视频在线观看 | 国产免费拔擦拔擦8x高清 | 日本欧美在线视频 | 黄色一级大片在线免费看产 | 亚洲欧洲精品成人久久奇米网 | 91在线色视频 | 一区二区三区久久 | 亚洲国产高清在线观看 | 91久久久www播放日本观看 | 精品欧美一区二区在线观看欧美熟 | 国产a级毛片| 天堂久久久久久久 | 日韩av一二三区 | 久久国产亚洲 | 日韩国产在线观看 | 日本不卡免费新一二三区 | 成人性生交大片 | 日批日韩在线观看 | 日韩一区二区在线播放 | 久久久精品网 | www.亚洲一区二区 | 日韩免费视频一区二区 | 国产一区二区三区在线看 | 91精品国产一区二区三区 | 国产精品一区二区欧美黑人喷潮水 | 福利视频日韩 | 欧美精品tv| 久久成人av电影 | 日韩国产欧美视频 | 国产成人一区二区三区电影 | 亚洲成人午夜电影 | 九九热re | 一区二区日韩精品 | 日韩一区二区三区在线观看 | 日韩久久精品视频 |