This is my billing table in my sql:

        id pid quantity total discount price customer
        1 1 2 20.00 5.00 15 a
        2 1 2 20.00 3.00 17.00 a
        3 2 3 15.00 2.00 13.00 b
        4 3 1 2.00 1.00 1.00 a

    This is my product master table

        id name mrp
        1 pen 10.00
        2 pencil 5.00
        3 rubber 2.00

    From these two tables I got output like this. Using this query $res=mysql_query("select productmaster.name, billing.quantity,billing.total,billing.discount,billing.price from productmaster INNER JOIN billing on productmaster.id= billing.pid");

        name quantity total discount price
        pen 2 20.00 5.00 15
        pen 2 20.00 3.00 17.00
        pencil 3 15.00 2.00 13.00
        rubber 1 2.00 1.00 1.00

    and I want to get outputlike this .How ? Can any one do help? its urgent,....



    This is my billing table in my sql:

        id pid quantity total discount price customer
        1     1       2   20.00   5.00  15    a
        2      1      2   20.00    3.00 17.00 a
        3      2      3   15.00    2.00 13.00 b
        4      3      1   2.00     1.00 1.00  a

    This is my product master table

        id name mrp
        1 pen 10.00
        2 pencil 5.00
        3 rubber 2.00

    From these two tables I got output like this. Using this query $res=mysql_query("select productmaster.name, billing.quantity,billing.total,billing.discount,billing.price from productmaster INNER JOIN billing on productmaster.id= billing.pid");


    customer  product quantity  price dicount total
    a         pen     4         40     8       32
    a         Rubber  1         2       1      1
    b         pencil  3         15      2      13        
    and I want to get for each cutomer .How ? Can any one do help? its urgent,....

The Sql Statement should be

"select B.customer, P.name, B.quantity,B.total,B.discount,B.price from productmaster P INNER JOIN billing B on B.pid = P.id Order By P.id"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.