Posted query retrieving all the relevant fields but the SUM(af_py_commission) function causing problem as in and it simply add an extra zero at the end and then on the right end.
e.g. if the answer is 45 it will give 450 and data format of the field is float else this query is working perfect….
I’ve tried a simple query with same function on the same field but without the joins so it work fine and give correct ans. Can anyone help what i’m doing wrong in this>??
SELECT f.af_id AS af_if
, aff_cust_tbl.af_id AS cu_af_id
, aff_payment_tbl.af_cust_id AS pym_cus_id
, SUM(af_py_commission)
FROM aff_tbl AS f
INNER JOIN aff_tbl ON f.af_id = 2
INNER JOIN aff_cust_tbl ON aff_cust_tbl.af_id = 2
INNER JOIN aff_payment_tbl ON aff_payment_tbl.af_id = 2;
There is a mistake in inner join
try this:
The edited line is
Try this:
If It doesn’t give right result try without sum and post analysis here…