pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    <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="62io2uc" 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查詢以根據(jù)自定義列名和值獲取值

      MySQL query to get values based on custom column name and values(MySQL查詢以根據(jù)自定義列名和值獲取值)
      <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="yo2syg2" 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查詢以根據(jù)自定義列名和值獲取值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                限時送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
                

                現(xiàn)在我想進(jìn)行一些查詢,以便最終輸出應(yīng)該像這樣顯示

                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
                

                所以為了實現(xiàn)這一點,我做了一些這樣的查詢

                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
                

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

                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 兩次來做到這一點,一次針對國家/地區(qū),一次針對注冊:

                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;
                

                這篇關(guān)于MySQL查詢以根據(jù)自定義列名和值獲取值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(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ù)庫列表和 SQL Server 實例使用的空間嗎?) - IT屋-程序員軟件開發(fā)
                How to create a login to a SQL Server instance?(如何創(chuàng)建對 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()?(為什么會出現(xiàn)“數(shù)據(jù)類型轉(zhuǎn)換錯誤?使用 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="qgwks2q" 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>
                          主站蜘蛛池模板: 无锡装修装潢公司,口碑好的装饰装修公司-无锡索美装饰设计工程有限公司 | LED太阳能中国结|发光红灯笼|灯杆造型灯|节日灯|太阳能灯笼|LED路灯杆装饰造型灯-北京中海轩光电 | 压力变送器-上海武锐自动化设备有限公司 | 免联考国际MBA_在职MBA报考条件/科目/排名-MBA信息网 | 应急灯_消防应急灯_应急照明灯_应急灯厂家-大成智慧官网 | 防腐木批发价格_深圳_惠州_东莞防腐木厂家_森源(深圳)防腐木有限公司 | 英语词典_成语词典_日语词典_法语词典_在线词典网 | 家庭教育吧-在线家庭教育平台,专注青少年家庭教育 | 首页-瓜尔胶系列-化工单体系列-油田压裂助剂-瓜尔胶厂家-山东广浦生物科技有限公司 | 高尔夫球杆_高尔夫果岭_高尔夫用品-深圳市新高品体育用品有限公司 | 【铜排折弯机,钢丝折弯成型机,汽车发泡钢丝折弯机,线材折弯机厂家,线材成型机,铁线折弯机】贝朗折弯机厂家_东莞市贝朗自动化设备有限公司 | 合肥活动房_安徽活动板房_集成打包箱房厂家-安徽玉强钢结构集成房屋有限公司 | 耐酸碱泵-自吸耐酸碱泵型号「品牌厂家」立式耐酸碱泵价格-昆山国宝过滤机有限公司首页 | 江西自考网| 大学食堂装修设计_公司餐厅效果图_工厂食堂改造_迈普装饰 | 外观设计_设备外观设计_外观设计公司_产品外观设计_机械设备外观设计_东莞工业设计公司-意品深蓝 | NM-02立式吸污机_ZHCS-02软轴刷_二合一吸刷软轴刷-厦门地坤科技有限公司 | 企业管理培训,企业培训公开课,企业内训课程,企业培训师 - 名课堂企业管理培训网 | 彩超机-黑白B超机-便携兽用B超机-多普勒彩超机价格「大为彩超」厂家 | 网站建设,北京网站建设,北京网站建设公司,网站系统开发,北京网站制作公司,响应式网站,做网站公司,海淀做网站,朝阳做网站,昌平做网站,建站公司 | 无线讲解器-导游讲解器-自助讲解器-分区讲解系统 品牌生产厂家[鹰米讲解-合肥市徽马信息科技有限公司] | 泰国试管婴儿_泰国第三代试管婴儿费用|成功率|医院—新生代海外医疗 | 丹佛斯变频器-Danfoss战略代理经销商-上海津信变频器有限公司 | 广州中央空调回收,二手中央空调回收,旧空调回收,制冷设备回收,冷气机组回收公司-广州益夫制冷设备回收公司 | 福兰德PVC地板|PVC塑胶地板|PVC运动地板|PVC商用地板-中国弹性地板系统专业解决方案领先供应商! 福建成考网-福建成人高考网 | 工业设计,人工智能,体验式3D展示的智能技术交流服务平台-纳金网 J.S.Bach 圣巴赫_高端背景音乐系统_官网 | 办公室家具公司_办公家具品牌厂家_森拉堡办公家具【官网】 | 环氧铁红防锈漆_环氧漆_无溶剂环氧涂料_环氧防腐漆-华川涂料 | 青岛成人高考_山东成考报名网 | 压砖机、液压制砖机、静压砖机、环保砖机生产厂家—杜甫机械 | TPE_TPE热塑性弹性体_TPE原料价格_TPE材料厂家-惠州市中塑王塑胶制品公司- 中塑王塑胶制品有限公司 | 耐火浇注料价格-高强高铝-刚玉碳化硅耐磨浇注料厂家【直销】 | 杰恒蠕动泵-蠕动泵专业厂家-19年专注蠕动泵 | 深圳昂为官网-气体分析仪,沼气分析仪,动态配气仪,气体传感器厂家 | 定量包装机,颗粒定量包装机,粉剂定量包装机,背封颗粒包装机,定量灌装机-上海铸衡电子科技有限公司 | RO反渗透设备_厂家_价格_河南郑州江宇环保科技有限公司 | sus630/303cu不锈钢棒,440C/430F/17-4ph不锈钢研磨棒-江苏德镍金属科技有限公司 | 压接机|高精度压接机|手动压接机|昆明可耐特科技有限公司[官网] 胶泥瓷砖胶,轻质粉刷石膏,嵌缝石膏厂家,腻子粉批发,永康家德兴,永康市家德兴建材厂 | HV全空气系统_杭州暖通公司—杭州斯培尔冷暖设备有限公司 | 振动传感器,检波器-威海广达勘探仪器有限公司 | 智慧物联网行业一站式解决方案提供商-北京东成基业 |