直接在 DB 上执行时查询运行良好,但使用 PHP 执行时会失败。
SELECT count(A.age),LEFT(C.name, 10) FROM game A INNER JOIN `dixit` C ON (A.roll=C.roll) WHERE LEFT(C.added, 10)>='09-05-2013' group by LEFT(C.added, 10) INTO OUTFILE '/tmp/total.txt';
在 PHP 中:
$query_t = "
SELECT count(A.age),LEFT(C.name, 10)
FROM game A
INNER JOIN `dixit` C ON (A.roll=C.roll)
WHERE LEFT(C.added, 10)>='09-05-2013'
GROUP BY LEFT(C.added, 10)
INTO OUTFILE '/tmp/total.txt'
";
mysql_query($query_t) or die ("query failed");