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

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

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

    2. <legend id='SEqKA'><style id='SEqKA'><dir id='SEqKA'><q id='SEqKA'></q></dir></style></legend>

        獲取所有產品、類別和元數據的 SQL 查詢 woocomm

        SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產品、類別和元數據的 SQL 查詢 woocommerce/wordpress)
          <bdo id='pdAsR'></bdo><ul id='pdAsR'></ul>
          <legend id='pdAsR'><style id='pdAsR'><dir id='pdAsR'><q id='pdAsR'></q></dir></style></legend>
        • <tfoot id='pdAsR'></tfoot>
          • <i id='pdAsR'><tr id='pdAsR'><dt id='pdAsR'><q id='pdAsR'><span id='pdAsR'><b id='pdAsR'><form id='pdAsR'><ins id='pdAsR'></ins><ul id='pdAsR'></ul><sub id='pdAsR'></sub></form><legend id='pdAsR'></legend><bdo id='pdAsR'><pre id='pdAsR'><center id='pdAsR'></center></pre></bdo></b><th id='pdAsR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='pdAsR'><tfoot id='pdAsR'></tfoot><dl id='pdAsR'><fieldset id='pdAsR'></fieldset></dl></div>
                <tbody id='pdAsR'></tbody>

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

                1. 本文介紹了獲取所有產品、類別和元數據的 SQL 查詢 woocommerce/wordpress的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我一直在嘗試創建一個返回參數的查詢:

                  I'm stuck trying to create a query that returns me the parameters:

                  ID、post_title、post_content、類別、ID_category、SKU、名稱、庫存、價格

                  ID, post_title, post_content, category, ID_category, SKU, name, stock, price

                  此刻我有這個:

                  SELECT 
                   p.ID,
                   p.post_title,
                   `post_content`,
                   `post_excerpt`,
                   t.name AS product_category,
                   t.slug AS product_slug,
                   tt.term_taxonomy_id AS tt_term_taxonomia,
                   tr.term_taxonomy_id AS tr_term_taxonomia,
                   MAX(CASE WHEN pm1.meta_key = '_price' then pm1.meta_value ELSE NULL END) as price,
                   MAX(CASE WHEN pm1.meta_key = '_regular_price' then pm1.meta_value ELSE NULL END) as regular_price,
                   MAX(CASE WHEN pm1.meta_key = '_sale_price' then pm1.meta_value ELSE NULL END) as sale_price,
                   MAX(CASE WHEN pm1.meta_key = '_sku' then pm1.meta_value ELSE NULL END) as sku 
                  
                   FROM wp_posts p LEFT JOIN wp_postmeta pm1 ON ( pm1.post_id = p.ID)
                   LEFT JOIN   wp_term_relationships AS tr ON ( tr.object_id = p.ID )
                   LEFT JOIN   wp_term_taxonomy AS tt ON ( tt.taxonomy = 'product_cat' AND tr.object_id = tt.term_taxonomy_id)
                   LEFT JOIN   wp_terms AS t ON ( t.term_id = tt.term_id )
                   WHERE p.post_type in('product', 'product_variation') AND p.post_status = 'publish' AND p.post_content <> ''
                   GROUP BY p.ID,p.post_title
                  

                  它正確地為我提供了產品和元數據,但我很難在此查詢中獲得類別 ID 和類別名稱,而且我無法在網上找到信息.

                  And it is giving me correctly the products and the metadata but it is very difficult for me to get the category ID and the category name in this query and I haven't been able to find information on the net.

                  謝謝.

                  推薦答案

                  您讓 object_id 加入到 term_taxonomy_id 中,這毫無意義.

                  You had object_id joining to term_taxonomy_id which made no sense.

                  這就是我認為應該是這樣的 -- 警告:我從來沒有查詢過 wp 數據庫,只是查看了文檔.

                  Here is how I think it should be -- caveat: I've never queried a wp database and was just going by the documentation.

                  SELECT 
                    p.ID,
                    p.post_title,
                    `post_content`,
                    `post_excerpt`,
                    t.name AS product_category,
                    t.term_id AS product_id,
                    t.slug AS product_slug,
                    tt.term_taxonomy_id AS tt_term_taxonomia,
                    tr.term_taxonomy_id AS tr_term_taxonomia,
                    MAX(CASE WHEN pm1.meta_key = '_price' then pm1.meta_value ELSE NULL END) as price,
                    MAX(CASE WHEN pm1.meta_key = '_regular_price' then pm1.meta_value ELSE NULL END) as regular_price,
                    MAX(CASE WHEN pm1.meta_key = '_sale_price' then pm1.meta_value ELSE NULL END) as sale_price,
                    MAX(CASE WHEN pm1.meta_key = '_sku' then pm1.meta_value ELSE NULL END) as sku 
                  FROM wp_posts p 
                  LEFT JOIN wp_postmeta pm1 ON pm1.post_id = p.ID
                  LEFT JOIN wp_term_relationships AS tr ON tr.object_id = p.ID
                  JOIN wp_term_taxonomy AS tt ON tt.taxonomy = 'product_cat' AND tt.term_taxonomy_id = tr.term_taxonomy_id 
                  JOIN wp_terms AS t ON t.term_id = tt.term_id
                  WHERE p.post_type in('product', 'product_variation') AND p.post_status = 'publish' AND p.post_content <> ''
                  GROUP BY p.ID,p.post_title
                  

                  這篇關于獲取所有產品、類別和元數據的 SQL 查詢 woocommerce/wordpress的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  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?)
                  WinForms application design - moving documents from SQL Server to file storage(WinForms 應用程序設計——將文檔從 SQL Server 移動到文件存儲)

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

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

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

                          • <tfoot id='QADZS'></tfoot>
                            主站蜘蛛池模板: 国产成人精品免费视频 | 91偷拍精品一区二区三区 | 日日摸日日碰夜夜爽亚洲精品蜜乳 | 精品视频一区二区在线观看 | 久久69精品久久久久久久电影好 | 91看片视频 | 在线视频99 | 羞羞视频一区二区 | 成人精品一区二区三区四区 | 亚洲精选久久 | 婷婷五月色综合 | 国产精品久久久久无码av | 中文字幕一区二区三区日韩精品 | 国产中文字幕在线观看 | 中文字幕精品一区久久久久 | 一区二区三区中文字幕 | 国产一区二区三区视频 | 欧美一级久久久猛烈a大片 日韩av免费在线观看 | 日韩欧美视频免费在线观看 | 成人免费大片黄在线播放 | 精品二三区 | 一级黄色生活视频 | 91精品久久久久久久久中文字幕 | 精品中文字幕一区二区 | 成人久久18免费网站图片 | 国产精品久久久久久久久久 | a级在线观看 | 成人在线一区二区 | 九九热精品视频 | 精品三区 | 婷婷色国产偷v国产偷v小说 | 国产欧美精品一区二区色综合 | 日韩电影免费在线观看中文字幕 | 欧美成人精品一区二区三区 | 久久精品亚洲精品国产欧美 | 正在播放国产精品 | 欧美日韩精品一区二区三区四区 | 亚洲精品乱码久久久久久蜜桃91 | 国产视频福利一区 | 在线观看国产三级 | 美女视频一区二区三区 |