2010/5/12 Platonides <platoni...@gmail.com>: > $n = Sql_query( "SELECT (SELECT COUNT(*) FROM code_rev WHERE > cr_repo_id=1 AND cr_timestamp >= '$epoch' $extra AND cr_path LIKE > "/trunk/phase3%") + (SELECT COUNT(*) FROM code_rev WHERE cr_repo_id=1 > AND cr_timestamp >= '$epoch' $extra AND cr_path="/trunk") + (SELECT > COUNT(*) FROM code_rev WHERE cr_repo_id=1 AND cr_timestamp >= '$epoch' > $extra AND cr_path="/") ); > This query won't work. Each revision has multiple entries on the code_rev table, one for each path. This means you need to use COUNT(DISTINCT cr_id) and need to drop the second and third subqueries. You also need to use single quotes throughout the query, because it's wrapped in double quotes. Furthermore, the correct function name is mysql_query():
$n = mysql_query( "SELECT COUNT(DISTINCT cr_id) FROM code_rev WHERE cr_repo_id=1 AND cr_timestamp >= '$epoch' $extra AND cr_path LIKE '/trunk/phase3%'"); Roan Kattouw (Catrope) _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l