How to exclude rows with 0 coincidences when using Mjoin?

How to exclude rows with 0 coincidences when using Mjoin?

IagoParisIagoParis Posts: 1Questions: 1Answers: 0

I'm using MJoin to join a teachers table with the subjects they teach. I use a where inside to show only teachers who teach a specific subject ($subject) but my table shows every teacher, in spite of some of them having 0 coincidences (i. e. they don't teach $subject). This is de Mjoin code:

->join(
       Mjoin::inst('profe_subjects')
            ->link($USERS_ID, 'profe_subjects.profe')
            ->fields(
                Field::inst('subject')
            )
            ->where('profe_subjects.subject', $subject, '=')
    )

How can I exclude the rows of my main table that got o coincidences from this Mjoin? Or how can I use a where condition outside the Mjoin with a field instantiated inside the Mjoin (profe_subject.subjects) in this case?

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    There isn't an option for that at the moment I'm afraid. I'll have a think about how something like this might be added.

    Allan

Sign In or Register to comment.