Tuesday, 27 August 2013

selecting two diffferent data from different table and display the value

selecting two diffferent data from different table and display the value

i have two tables tbl_product and tbl_sales. my problem is that how
can i get the data from two different table and display it
horizontally and sum the "total" and "discount" from tbl_rsales. for
example
the ff data in my tbl_products are
id|pcode|pdesc |
1 |1000 |wire |
2 |1443 |capactor |
and the ff data in my tbl_sales are
id|total|discount| pcode |
1 |1000 |10 | 1000 |
2 |2000 |20 | 1443 |
3 |1000 |10 | 1000 |
4 |1000 |20 | 1443 |
the expected output must be something like this. how can i select it from
two different table?
id | pcode | pdesc | total | discount |
1 | 1000 | wire | 2000 | 20 |
2 | 1443 | capacitor | 3000 | 40 |

No comments:

Post a Comment