From 389de251e8e95044198f0e7cbdf0d3855799489b Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Tue, 2 Nov 2004 14:13:13 +0000 Subject: [PATCH] dedicqted to yann how to take the line in MySQL thqt minimize a constraint --- scripts/cron/send_nl.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/cron/send_nl.php b/scripts/cron/send_nl.php index 79d32e6..b30cdce 100755 --- a/scripts/cron/send_nl.php +++ b/scripts/cron/send_nl.php @@ -19,7 +19,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: send_nl.php,v 1.5 2004-11-02 11:34:17 x2000habouzit Exp $ + $Id: send_nl.php,v 1.6 2004-11-02 14:13:13 x2000habouzit Exp $ ***************************************************************************/ require('./connect.db.inc.php'); @@ -50,8 +50,10 @@ while(true) { $sql = mysql_query("SELECT ni.user_id,ni.pref, a.alias, u.prenom,u.nom, FIND_IN_SET(u.flags, 'femme') FROM newsletter_ins AS ni INNER JOIN auth_user_md5 AS u USING(user_id) - INNER JOIN aliases AS a ON(u.user_id=a.id AND a.type='a_vie') - WHERE ni.last<$id + INNER JOIN aliases AS a ON(u.user_id=a.id AND a.type!='homonyme') + LEFT JOIN aliases AS b ON(u.user_id=b.id AND a.type!='homonyme' + AND LENGTH(a.alias)>LENGTH(b.alias)) + WHERE b.alias IS NULL AND ni.last<$id LIMIT 60"); if(!mysql_num_rows($sql)) exit(0); $sent = Array(); -- 2.1.4