--- mysql.c.old 2010-04-23 01:20:15.501991984 +0200 +++ mysql.c 2010-04-23 01:28:58.686133271 +0200 @@ -325,7 +325,7 @@ g_string_sprintf (buf, "SELECT id, number, text, dreport FROM outbox \ WHERE processed='0' AND CURTIME() >= not_before \ - AND CURTIME() <= not_after %s", phnStr->str); + AND CURTIME() <= not_after %s ORDER by insertdate", phnStr->str); g_string_free (phnStr, TRUE); if (mysql_real_query (&mysqlOut, buf->str, buf->len))