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

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

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

        <bdo id='x0pgc'></bdo><ul id='x0pgc'></ul>
    1. <tfoot id='x0pgc'></tfoot>

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

        mySQL 查詢鍵值對

        mySQL query key value pairs(mySQL 查詢鍵值對)
          <bdo id='WXRFA'></bdo><ul id='WXRFA'></ul>

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

              <tbody id='WXRFA'></tbody>
          3. <tfoot id='WXRFA'></tfoot>

                  本文介紹了mySQL 查詢鍵值對的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我正在對 wordpress 表 (postmeta) 進行查詢.該表有鍵和值,我需要一個查詢來獲取所有匹配key1"等于value1"和key2"等于value2"的行,按value2排序

                  I am doing a query on a wordpress table (postmeta). The table has keys and values and I need a query that will get all rows that match "key1" equal to "value1" and "key2" equal to "value2" ordered by value2

                  該表基本上有 id、postid、key 和 value 列.

                  The table basically has an id, postid, key and value columns.

                  我什至不知道從哪里開始.我可以找到一個很好的值,即 ... where key='featured' &值=真.但我需要按行的值排序的前 25 個,其中 key='hits' 意味著我需要這些特色行的相應(yīng)命中鍵的值

                  I am not sure even where to start. I can find one value fine ie ... where key='featured' & value=true. But I need the top 25 ordered by the value of the rows where key='hits' meaning I need the value of the corresponding hits key for those featured rows

                  我不知道該怎么做.

                  TIA

                  推薦答案

                  根據(jù)您提供的有限詳細信息,很難確切說明如何執(zhí)行此操作.但是當(dāng)您想返回鍵/值對時,您可以使用以下方法.

                  It is difficult to say exactly how to do this with the limited details that you provided. But when you want to return key/value pairs you can use the following.

                  您可以多次加入您的桌子:

                  You can join on your table multiple times:

                  select p1.postid,
                    p1.value Featured,
                    p2.value Hits
                  from postmeta p1
                  left join postmeta p2
                    on p1.postid = p2.postid
                    and p2.key = 'hits'
                  where p1.key ='featured';
                  

                  參見SQL Fiddle with Demo

                  或者你可以使用帶有 CASE 表達式的聚合函數(shù)(使用 sum() 假設(shè)一個數(shù)值,你可以使用 max()/min() 用于字符串值:

                  Or you can use an aggregate function with a CASE expression (using sum() assumes a numeric value, you can use max()/min() for string values:

                  select postid,
                    sum(case when `key` = 'featured' then value end) Featured,
                    sum(case when `key` = 'hits' then value end) Hits
                  from postmeta
                  group by postid
                  

                  參見SQL Fiddle with Demo

                  這篇關(guān)于mySQL 查詢鍵值對的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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的版本和版本)
                  WinForms application design - moving documents from SQL Server to file storage(WinForms 應(yīng)用程序設(shè)計——將文檔從 SQL Server 移動到文件存儲)
                  How to use MySQL in WSL (Windows Subsystem for Linux)?(如何在 WSL(Linux 的 Windows 子系統(tǒng))中使用 MySQL?)

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

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

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

                          • 主站蜘蛛池模板: 日韩精品一区二区三区中文在线 | 午夜www| 亚洲精品国产一区 | 99这里只有精品视频 | 麻豆av片 | 欧美日韩一区二区视频在线观看 | 欧美一区二区免费 | 精品一区二区久久久久久久网站 | 视频一区中文字幕 | 成人毛片视频在线播放 | 一区二区视屏 | 一级黄色日本片 | 天天玩天天干天天操 | 91久久精品一区二区二区 | 中文字幕一区二区三区精彩视频 | 天堂成人av | 一区二区视频在线 | 欧美一区二区三区精品免费 | 青青草一区 | 亚洲视频一 | 亚洲天堂免费 | 久久机热 | 婷婷激情五月网 | www免费视频 | 午夜三区| 免费看国产片在线观看 | 黄视频网址 | 国产伊人精品 | 国产一区不卡 | 国产精品久久久久久久久久免费看 | 久久国内精品 | 久草免费在线视频 | 91天堂网 | 日日碰狠狠躁久久躁婷婷 | 日日噜 | 中文字幕av高清 | 日韩在线免费视频 | 先锋影音资源网站 | 亚洲 中文 欧美 日韩 在线观看 | 国产成人精品一区二 | aa级毛片毛片免费观看久 |