1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Need to cross-join results in a dbjoin element

Discussion in 'Community' started by mirceat, Apr 26, 2019.

  1. mirceat

    mirceat Member

    Level: Community

    I know that i can use subqueries as a condition for a dbjoin element to search in another table(s) (ex: {thistable}.id IN (select field from another table), but the subquery will return distinct values and i need to return all the rows.

    For example, running this kind of query in database will return the desired result:
    Code (Text):
    select a.parent_id as value, a.denumire_camp as text
    from contracte_setari_739_repeat a
    join contracts_tool_servicii b on a.parent_id = b.abonament
    where b.id_contract_main = 123457967
    order by b.abonament
    and the result is (note the duplicates for the text "Dynamic Smart National")

    While using a subquery like this

    Code (Text):
    SELECT parent_id as value, denumire_camp as text
    from contracte_setari_739_repeat
    WHERE parent_id IN (
        SELECT abonament
        FROM contracts_tool_servicii
        WHERE id_contract_main = 123457967  
    will return distinct values:

    can i do it with Fabrik and dbjoin element?

    Thank you
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I'm not sure what you are asking.

    Do you need the join element to display the duplicate rows? If so, that won't work. The join element is designed around displaying unique id's (values).

    -- hugh

Share This Page