SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql query help please

    ok, imagine i have a db full of this sort of stuff

    Agentnumber Ordernumber Total amount commission totalcommission
    ___________________________________________________________________
    123456 acb1234 1.99 10% .19
    123521 qwe9874 2.99 10% .29
    123456 rde98745 6.99 10% .69
    123521 wer8548 8.99 10% .89


    how can i pull that out of the db so i can get the following to show in my table

    Agentnumber Ordernumber Total amount commission totalcommission
    ___________________________________________________________________
    123456 acb1234 1.99 10% .19
    123456 rde98745 6.99 10% .69

    Total commision topay .98

    Agentnumber Ordernumber Total amount commission totalcommission
    ___________________________________________________________________
    123521 qwe9874 2.99 10% .29
    123521 wer8548 8.99 10% .89

    Total commision topay 1.18


    i know to get the total commision to pay i need to sum the query and can handle that bit im just not sure how to group them by agent number to seperate the agents??

    any help

    cheers
    chris

    ps hope you can understand what i have just waffled on about

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure what you need, but try this :-)

    Code:
    SELECT Agentnumber, SUM(totalcommission) GROUP BY Agentnumber


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •