Maybe you don't write the query. If you have built your model (see https://docs.phalcon.io/en/latest/reference/models.html) including relationship definitions e.g. in Robots $this->hasMany("id", "RobotsParts", "robots_id"); and in RobotParts $this->belongsTo("robots_id", "Robots", "id");, you can access, in this case, the Robot xyz parameter from the RobotParts using $robot_part->robots->xyz. You can also retrieve the robot parts from for a specific robot using $robotsParts = $robot->robotsParts;. It's more conveneint than writing sql queries and if your table change you only need to change to model, not every instances you used a query.