dusty
dusty

Reputation: 189

Typoscript join

I need to select * from tt_content where colPos=4 and uid is in sys_category_record_mm (category Uid_local=14)

I try this, but result was null

styles.content.getTop {
    table= tt_content
    select{
        selectFields = *
        join = sys_category_record_mm ON (sys_category_record_mm.uid_foreign=tt_content.uid)
        where = tt_content.colPos=4
        andWhere = sys_category_record_mm.uid_local=14

    }
}

Can you help me?

Upvotes: 1

Views: 1602

Answers (1)

dusty
dusty

Reputation: 189

Thanx lorenz

The problem was missing orderBy

styles.content.getTop {
    table = tt_content
    select{
        orderBy = tt_content.sorting
        selectFields = *
        join = sys_category_record_mm ON sys_category_record_mm.uid_foreign=tt_content.uid
        where = tt_content.colPos=4
        andWhere = sys_category_record_mm.uid_local=14

    }
}

I think default is "sorting" but if 2 tables are joined sorting is ambiguous so i must add tt_content.sorting

:-)

Upvotes: 1

Related Questions