MySQL Wordpress数据搜索查询

时间:2015-10-02 10:20:40

标签: mysql wordpress

我正试图从MySQL数据库中提取一些数据,作为Wordpress网站的一部分,将其移至新的Wordpress网站。

我正在尝试抓取某个类别中的所有帖子,以便我可以导出它们。用简单的英语,我试着做以下几点:

  1. 在表格 wp_term_relationships 表格中,列出与 term_taxonomy_id “17”
  2. 相关联的所有 object_id 数字
  3. 然后 - 在 wp_posts 中搜索 ID =的所有行到第1点的 object_id 列表
  4. 我不介意用第1点的条目手动构建一个搜索词,因为如果它更容易跳到第2点,只有88个?

    我正在使用Sequel Pro& mysqlworkbench查询工具访问数据库&出口/进口&操纵数据。

    由于

    更新这是我到目前为止所得到的:

    SELECT * FROM `wp_posts` WHERE `ID` = '535' ORDER BY `post_author` LIMIT 0,1000
    

    我想有效地搜索ID 535,536,153等...

1 个答案:

答案 0 :(得分:0)

好的,明白了:

SELECT *
FROM `wp_posts` 
WHERE 
(
    (`ID` = '535') OR (`ID` = '539') OR (`ID` = '803') OR  (`ID` = '919') OR  (`ID` = '958') OR (`ID` = '1188') OR (`ID` = '1284') OR (`ID` = '1287') OR (`ID` = '1332') OR (`ID` = '1359') OR (`ID` = '1378') OR (`ID` = '1450') OR (`ID` = '1474') OR (`ID` = '1543') OR (`ID` = '1547') OR (`ID` = '1556') OR (`ID` = '1573') OR (`ID` = '1596') OR (`ID` = '1598') OR (`ID` = '1677') OR (`ID` = '1706') OR (`ID` = '1708') OR (`ID` = '1813') OR (`ID` = '1868') OR (`ID` = '1956') OR (`ID` = '1979') OR (`ID` = '2013') OR (`ID` = '2020') OR (`ID` = '2089') OR (`ID` = '2159') OR (`ID` = '2201') OR (`ID` = '2231') OR (`ID` = '2243') OR (`ID` = '2409') OR (`ID` = '2506') OR (`ID` = '2572') OR (`ID` = '2721') OR (`ID` = '3337') OR (`ID` = '3421') OR (`ID` = '3481') OR (`ID` = '3625') OR (`ID` = '3701') OR (`ID` = '3706') OR (`ID` = '4013') OR (`ID` = '4182') OR (`ID` = '4276') OR (`ID` = '4328') OR (`ID` = '4373') OR (`ID` = '4405') OR (`ID` = '4438') OR (`ID` = '4506') OR (`ID` = '4565') OR (`ID` = '4628') OR (`ID` = '4681') OR (`ID` = '4732') OR (`ID` = '4767') OR (`ID` = '4836') OR (`ID` = '4920') OR (`ID` = '4968') OR (`ID` = '5017') OR (`ID` = '5038') OR (`ID` = '5115') OR (`ID` = '5144') OR (`ID` = '5215') OR (`ID` = '5244') OR (`ID` = '5318') OR (`ID` = '5339') OR (`ID` = '5384') OR (`ID` = '5406') OR (`ID` = '5450') OR (`ID` = '5515') OR (`ID` = '5821') OR (`ID` = '6070') OR (`ID` = '6178') OR (`ID` = '6238') OR (`ID` = '6288') OR (`ID` = '6355') OR (`ID` = '6510') OR (`ID` = '6612') OR (`ID` = '6690') OR (`ID` = '6756') OR (`ID` = '6776') OR (`ID` = '6792') OR (`ID` = '6822') OR (`ID` = '6835') OR (`ID` = '7631') OR (`ID` = '8241') OR (`ID` = '8671')
)
ORDER BY `post_author`