Skip to content

Bug: Join Query is not working in Library #3600

Closed
@SyedMuradAliShah

Description

@SyedMuradAliShah

Description
I think its a bug as well, using the query builder, the join query is not working! It gets only the table mention inside table() i.e acl_roles_permissions, while in MySQL Manager I'm getting the result with join.

$db = \Config\Database::connect();
$res = $db->table('acl_roles_permissions')
     ->select('`acl_roles_permissions`.`role_id` as `permission_role_id`,`acl_roles_permissions`.`permission_id`, `permissions`.`key` as `permission_key`,`permissions.name` as `permission_name`')
     ->join('acl_permissions permissions', 'permissions.id = acl_roles_permissions.permission_id')
     ->where('acl_roles_permissions.role_id', $role_id);
if ($res->countAllResults() > 0) {
     print_r($res->get()->getResultArray());

Result of above code in the library
Screenshot_5

The same query runs inside MySQL manager.
Screenshot_4

CodeIgniter 4 version
4.0.4

Context

  • Windows 10
  • PHP version 7.2.19

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions