0

谁能帮我将此mysql查询转换为redbean查询?

SELECT category,sum(price) from transaction GROUP BY category.
4

3 回答 3

3

我们可以像这样使用

$results = R::getAll( 'SELECT category,sum(price) from transaction GROUP BY category' ); 
// $results is multidimensional array

这是参考链接:http ://www.redbeanphp.com/queries

于 2013-10-22T19:02:02.070 回答
0

更好的转换是:

$sql = "SELECT category, sum(price) FROM transaction GROUP BY category";

$transactions = R::getAll($sql);

于 2013-01-08T23:09:43.243 回答
0

你不需要转换任何东西。你只需写:

$transactions = R::get("SELECT category,sum(price) from transaction GROUP BY category");
于 2012-05-06T19:47:23.000 回答