-$it = Xdb::iterRow("SELECT al1.alias, al2.alias, e1.email
- FROM emails AS e1
- INNER JOIN emails AS e2 ON (e1.email = e2.email AND e1.uid != e2.uid
- AND (e1.uid < e2.uid OR NOT FIND_IN_SET('active', e2.flags)))
- INNER JOIN aliases AS al1 ON (al1.uid = e1.uid AND al1.type = 'a_vie')
- INNER JOIN aliases AS al2 ON (al2.uid = e2.uid AND al2.type = 'a_vie')
- INNER JOIN accounts AS a1 ON (al1.uid = a1.uid)
- INNER JOIN accounts AS a2 ON (al2.uid = a2.uid)
- LEFT JOIN email_watch AS w ON (e1.email = w.email)
- WHERE FIND_IN_SET('active', e1.flags) AND w.email IS NULL
- ORDER BY al1.alias");
+$it = Xdb::iterRow("SELECT s1.email, s2.email, r1.redirect
+ FROM email_redirect_account AS r1
+ INNER JOIN email_redirect_account AS r2 ON (r1.redirect = r2.redirect AND r1.uid != r2.uid)
+ INNER JOIN email_source_account AS s1 ON (s1.uid = r1.uid AND s1.type = 'forlife')
+ INNER JOIN email_source_account AS s2 ON (s2.uid = r2.uid AND s2.type = 'forlife')
+ LEFT JOIN email_watch AS w ON (r1.redirect = w.email)
+ WHERE w.email IS NULL
+ GROUP BY r1.redirect
+ ORDER BY r1.redirect, s1.email");