We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Subqueries in query builder/PHQL

I was wondering if subqueries were supported for the FROM clause in Phalcon 2.0.5. I saw that they are supported in at least the WHERE clause.

I'm trying to do something similar to :

    SELECT columnA, columnB, columnC`
    FROM (SELECT Column A, ColumnB, TableB.ColumnC`
        FROM TableA
        JOIN TableB ON TableA.TableBId = TableB.id) AS temp
    WHERE ColumnB != 1;

Is that supported, or will I have to figure something else out ?



85.5k

i think its still unavaible, but phql improvemnts should come in the near future

https://forum.phalcon.io/discussion/2820/phalcon-subquery

Not sure why you need such a weird query? Just do normal join and normal FROM.