$ 20
#ID : 62

Help needed with SQL query for JetSmartFilters

September 19, 2025
Status : Assigned
Posted By : Yanno
Assigned to
Description :

I have a CCT called 'certificate' assigned to Users as 'one to many' relation. (One user can have many certificates)

The CCT certificate has 2 meta fields:
1) The Issuing organisation (Select field listing names of organisations)
2) Custom status (radio field - approved, pending, rejected)

I then have a JE Listing Grid on my User Archive template. Then I have a Radio filter setup using JetSmartFilters. This filter lists the 'Issuing organisation' values, and then filters through the users to find those who have a certificate issued (related) by the selected value.

Currently, I have this working as a custom SQL query that is querying the relationships and the issuing organisation, this is then passed into the JetSmartFilters.

This works well, however it currently only filters the users based on the 'Issuing organisation' meta alone.

For example, if I select 'ORG' as an issuing organisation, it will filter all the users that have certificates assigned by issuing organisation 'ORG'. But, this returns users with all statuses of their certificate: approved, pending and also rejected.

I can't seem to figure out how do I pass the second item 'Custom status' into the same query, same filter, so that it returns all of the users that have a certificate issued by company 'ORG', but only those where the certificate has a 'Custom status - approved'.