Last active
August 29, 2015 13:56
-
-
Save hodaddy/8811521 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
SQLSTATE[HY000]: General error: 1111 Invalid use of group function (SQL: select `i`.`id` as `invoice_id`, `i`.`client_id`, `i`.`mod_user_id`, `i`.`invoice_type_id`, `i`.`created_at` as `i_created_at`, `c`.`id` as `client_id`, `c`.`first_name`, `c`.`last_name`, `c`.`company`, `u`.`id` as `user_id`, `u`.`username`, `p`.`id` as `payment_id`, `p`.`paid`, `p`.`created_at` as `p_created_at`, `pt`.`name` as `payment_type`, (SUM(p.amount) - SUM(p.fee)) as p_total, SUM(t.list) as t_list, ((SUM(t.list) + (SUM(d.fee) + SUM(d.additional_cost))) - (SUM(p.amount) - SUM(p.fee))) as balance from `j_invoice` as `i` inner join `j_client` as `c` on `c`.`id` = `i`.`client_id` inner join `j_users` as `u` on `u`.`id` = `i`.`mod_user_id` inner join `j_invoice_payment` as `p` on `p`.`invoice_id` = `i`.`id` inner join `j_payment_type` as `pt` on `pt`.`id` = `p`.`payment_method_id` inner join `j_invoice_ticket` as `it` on `it`.`invoice_id` = `i`.`id` inner join `j_ticket` as `t` on `t`.`id` = `it`.`ticket_id` inner join `j_invoice_delivery` as `d` on `d`.`invoice_id` = `i`.`id` where (SUM(t.list) + SUM(d.fee) + SUM(d.additional_cost) - (SUM(p.amount) - SUM(p.fee))) = 0 group by `i`.`id` order by `i`.`updated_at` desc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment