We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8813
    • 18 Posts
    Hi,

    I'm having troubles generating 2 queries using same custom table.

    First Request
    $sql =   $modx->newQuery('User');
    $sql -> select('*');
    $sql->innerJoin('Project', 'Project', 'User.id = Project.user_id');
    $sql->prepare();
    echo $sql->toSQL();
    

    Which gives :
    select * from x_user User inner join x_project Project on User.id = Project.user_id

    Second Request
    $sql =   $modx->newQuery('Project');
    $sql -> select('*');
    $sql->innerJoin('File', 'File', 'File.project_id = Project.id');
    $sql->prepare();
    echo $sql->toSQL();
    

    Which gives :
    select * from  Project inner join x_file File on File.project_id = Project.id

    Should give
    select * from  x_project Project inner join x_file File on File.project_id = Project.id


    I would like to avoid the use of a second xpdo.


    Any ideas?

    Thanks