简体   繁体   English

在typo3数据库中按项目过滤记录

[英]Filter records by project in typo3 database

I have two projects: 我有两个项目:

1. ProjectFOO with Root Page UID 85 1.具有根UID 85的ProjectFOO

2. ProjectBAR with Root Page UID 1 2.具有根页面UID 1的ProjectBAR

专案

Both projects include the extension ke_search . 这两个项目都包含扩展名ke_search I need to update the record pages from the table tt_content where list_type is "ke_search_pi1" BUT only from ProjektFOO . 我需要从表tt_content更新记录pages ,其中list_type是“ ke_search_pi1”,但仅来自ProjektFOO

This is my sql so far: 到目前为止,这是我的sql:

UPDATE `tt_content` SET `pages` = 42 WHERE `list_type` = ke_search_pi1;

Problem : This SQL query will set pages from every project to 42, instead of selecting only records from ProjectFOO . 问题 :此SQL查询会将每个项目的pages设置为42,而不是仅从ProjectFOO中选择记录。

What do i have to include in my WHERE statement, to only select records from ProjectFOO ? 仅在ProjectFOO选择记录,我必须在WHERE语句中包括什么?

There is no root_pid column in the pages table. pages表中没有root_pid列。 So you would need to get the records recursively. 因此,您需要递归获取记录。

There is a post about selecting records recursively: How to do the Recursive SELECT query in MySQL? 关于递归选择记录的文章: 如何在MySQL中执行递归SELECT查询?

This way you can get all UID belonging to ROOT PID 85. After you create the temporary table you can use that one to update your tt_content table. 这样,您可以获得属于ROOT PID 85的所有UID。创建临时表后,可以使用该表来更新tt_content表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM