SELECT u.user, p.proj FROM IDS i LEFT JOIN USER u ON(i.u_id = u.id) LEFT JOIN PRO p ON(i.p_id = p.id)