Editor - Serverside PHP, Subquery or Count of joined Objects

Editor - Serverside PHP, Subquery or Count of joined Objects

phikuphiku Posts: 8Questions: 2Answers: 0

Hi,

unfortunately i did not find any solution for this in the forum.
I have a simple editor -> php based query for getting data to the client.

Now I want to return for each row the count value of entries in a different table.

In plain sql it would be something like:

SELECT t1.id,t1.cola,t1.colb,(SELECT count(action) from t_foreigntable as t2 where t2.f_id = t1.id AND t2.filtercolumn='filtervalue') as myCountValue

Any ideas ?

Thanks in advance

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Hi,

    Unfortunately the pre-built Editor libraries do not support sub-queries at this time in the select field list. If you are using the pre-built libraries you would need to "post process" the rows selected by Editor by looping over them and adding the required data.

    Read-only sub-queries is something that I would like to introduce in a future version of Editor. Thanks for bringing this up.

    Regards,
    Allan

  • phikuphiku Posts: 8Questions: 2Answers: 0

    Hi allan,

    thank you for your answer.
    Would be a nice feature in the future.

    Best regards,
    Phil

This discussion has been closed.