I try to create a query to get all news items, that are flagged with at least two different categories and they have to match the AND clause.
I need this query to make a decision, if the following code should be rendered, or not. E.g. If there is no news item with category A and category B, do nothing. Else show tx_news LIST view.
lib.field_dmnewsplugin.5 = CONTENT
lib.field_dmnewsplugin.5 {
table = tx_news_domain_model_news
select {
pidInList = 124
max = 9
orderBy = uid DESC
leftjoin = sys_category_record_mm ON (sys_category_record_mm.uid_foreign = tx_news_domain_model_news.uid)
#andWhere = sys_category_record_mm.uid_local IN (14,16)
#where = sys_category_record_mm.uid_local = 14
andWhere = sys_category_record_mm.uid_local = 14 AND sys_category_record_mm.uid_local = 16
}
renderObj = COA
renderObj {
1 = TEXT
1.value = Aktuelles
1.wrap = <h2>|</h2>
2 = TEXT
2.field = title
2.crop = 50|...|1
2.wrap = <h3>|</h3>
3 = TEXT
3.field = teaser
3.crop = 500|...|1
3.wrap = <p>|</p>
}
}
My code is the result of some testings. With the "andWhere" clause, the result is empty. without any where clause, I get double entries for all news items, because all of them have at least two different categories. My goal is to get unique results for each news item, that is flagged with category A and category B (and maybe as an universal solution additional categories).
What do I have to do?
Thank you in advance,
Ralf