Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8695627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:05:06+00:00 2026-06-13T01:05:06+00:00

Posted query retrieving all the relevant fields but the SUM(af_py_commission) function causing problem as

  • 0

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;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:05:07+00:00Added an answer on June 13, 2026 at 1:05 am

    There is a mistake in inner join

    try 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 as f2
    ON f.af_id = 2 AND f2.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;
    

    The edited line is

     INNER JOIN aff_tbl as f2
     ON f.af_id = 2 AND f2.af_id=2
    

    Try 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_cust_tbl 
                   ON f.af_id = aff_cust_tbl.af_id 
           INNER JOIN aff_payment_tbl 
                   ON aff_payment_tbl.af_id = aff_cust_tbl.af_id 
    WHERE  f.af_id = 2; 
    

    If It doesn’t give right result try without sum and post analysis here…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a Facebook query that will return all comments posted
I posted a related question to no response but here I'll be less narrow.
I posted a related but still different question regarding Protobuf-Net before, so here goes:
(first posted on google group but no response so assuming I should be posting
I posted another one on this,, but i had to edit it really much...
I have this problem that I have multiple fields that updates a database via
A while ago I posted a message about optimizing a query in MySQL. I
I have a similar query to the one posted here . I create a
how can i query my mysql database and fetch rows which are posted in
this is my first posted question. I have a fairly complicated OQL query which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.