Note that there are some explanatory texts on larger screens.

plurals
  1. POTwo tables in mysql, how to fetch data from those tables
    primarykey
    data
    text
    <p>I have two tables..</p> <p><strong>Client Bills</strong> - Contains bill infor for clients</p> <p><strong>from billRecievedFromClient</strong> - contains the amount we receievd from client for a bill</p> <p><strong>mysql> select * from clientBills;</strong></p> <p>+------------+------------+------------+------------+</p> <p>| date | clientCode | billNumber | billAmount |</p> <p>+------------+------------+------------+------------+</p> <p>| 2012-02-17 | C0001 | B0001 | 1200.00 |</p> <p>| 2012-02-17 | C0001 | B0002 | 1000.00 |</p> <p>| 2012-02-17 | C0002 | B0003 | 1233.00 |</p> <p>| 2012-02-18 | C0003 | B0004 | 12000.00 |</p> <p>| 2012-02-18 | C0001 | B0005 | 400.00 |</p> <p>+------------+------------+------------+------------+</p> <p><strong>mysql> select * from billRecievedFromClient;</strong></p> <p>+------------+--------------+---------------+--------+---------+</p> <p>| Date | receivedCode | forBillNumber | amount | remarks |</p> <p>+------------+--------------+---------------+--------+---------+</p> <p>| 2012-02-18 | R0001 | B0001 | 200.00 | CASH |</p> <p>| 2012-02-18 | R0002 | B0001 | 300.00 | CASH |</p> <p>| 2012-02-18 | R0003 | B0002 | 300.00 | CASH |</p> <p>| 2012-02-18 | R0004 | B0003 | 233.00 | CASH |</p> <p>| 2012-02-18 | R0005 | B0001 | 700.00 | CASH |</p> <p>+------------+--------------+---------------+--------+---------+</p> <p><strong>Now i want Information Like this ---</strong> i.e. for client C0001 , there are 3 bills. And he made payment for one bill completelly, for one bill partially and one bill complete amount is due..</p> <p>+------------+------------+------------------------------------+</p> <p>| billNumber | billAmount | SUM(billRecievedFromClient.amount) |</p> <p>+------------+------------+------------------------------------+</p> <p>| B0001 | 1200.00 | 1200.00 |</p> <p>| B0002 | 1000.00 | 300.00 |</p> <p>| B0005 | 400.00 | 00.00 |</p> <p>+------------+------------+------------------------------------+</p> <p>remember since he not started payment for third bill, there wont be any entry for that in second table..</p> <p>What can be the query for this??</p> <p>please suggest..</p> <p>Thanks a lot!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload