
April 11th, 2016, 12:53 PM
|
Registered User
|
|
Join Date: Apr 2016
Posts: 1
Time spent in forums: 30 m 25 sec
Reputation Power: 0
|
|
Need help with this query please!!
SELECT value AS $point_fld,
COUNT(value) as cnt
FROM ?_data d
LEFT JOIN ?_user u
ON d.`table` = 'user' AND d.`id` = u.user_id
WHERE `key` = ? AND `value`<>'' AND `value`<>'Blank' AND u.added BETWEEN ? AND ?
LEFT JOIN ?_invoice_payment p
ON d.'id' = p.user_id
SUM(p.amount) as moneysum
GROUP BY $point_fld"
So I am trying to edit this query to add in a sum value for payments based on which users are returned in the first part. The red text is what I added. It is working just as intended but when i add in my part to get the values it breaks it. Any suggestions would be amazing thanks. Im pretty new to joins and stuff in sql so be nice 
|