Last active
August 29, 2015 14:08
-
-
Save nsanden/6a74fbad19282cffd93c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$transes = (new \yii\db\Query()) | |
->select('DATE_FORMAT(FROM_UNIXTIME(`created`), "%M %Y") as `dates`, SUM(amount) AS amount, SUM(fee) AS fee, SUM(net) AS net, SUM(IF(`amount`< 0, `amount`, 0 )) AS pay_out') | |
->from('tbl_transaction_newest') | |
->groupBy('`dates`') | |
->limit(1000) | |
->orderBy('created') | |
->all(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `pay_out` FROM `tbl_transaction_newest` GROUP BY `dates` ORDER BY `created` L' at line 1 | |
The SQL being executed was: SELECT DATE_FORMAT(FROM_UNIXTIME(`created`), "%M %Y") as `dates`, SUM(amount) AS amount, SUM(fee) AS fee, SUM(net) AS net, SUM(IF(`amount`< `0`, `amount`, `0 ))` AS `pay_out` FROM `tbl_transaction_newest` GROUP BY `dates` ORDER BY `created` LIMIT 1000 | |
Error Info: Array | |
( | |
[0] => 42000 | |
[1] => 1064 | |
[2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `pay_out` FROM `tbl_transaction_newest` GROUP BY `dates` ORDER BY `created` L' at line 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment