glpi: [7] Refs #1996 Fixing bad performance when deploy

Backport of commit 0898442e206ccec256445aa3e388764527cacb

When adding a command to dyngroup, bad sql query was generated, with bad
joins.