0

是否可以在 Typoscript 中实现这种 SQL 请求以从 tt_content 表中检索一些内容?

SELECT (
        SELECT c1.uid
        FROM tt_content c1
        WHERE c1.header = c.header AND c1.pid=2 AND c1.sys_language_uid=0 AND c1.colPos=0 AND c1.deleted=0 AND c1.hidden=0 
        ORDER BY rand()
        LIMIT 1
) AS uid, c.header
FROM tt_content c
WHERE c.pid=2 AND c.sys_language_uid=0 AND c.colPos=0 AND c.deleted=0 AND c.hidden=0 
GROUP BY c.header
ORDER BY c.sorting

谢谢并恭祝安康。

4

1 回答 1

0

我将子查询移动到内部连接以进行此操作:

temp.random_teasers = CONTENT
temp.random_teasers {
    table = tt_content
    pidInList = 2
    select {
        join = (SELECT * FROM tt_content WHERE sys_language_uid=###L### AND colPos=0 AND deleted=0 AND hidden=0 ORDER BY rand()) t2 ON t2.uid = tt_content.uid
        groupBy = tt_content.header
        orderBy = tt_content.sorting
        markers {
            L.data = GP:L
            L.intval = 1
        }
    }
}
于 2013-03-21T13:04:16.797 回答