mercredi 4 février 2015

How to use a group by in inner join


I have Two tables


Table 1


|ID | totalamount |

|100| 1000 |

|101| 500 |

Table 2


|ID | Individualamount| |100 | 500 | |100 | 300 | |100 | 100 | |101 | 200 | |101 | 300 | I Need a result which shows


|ID |TotalAmount|sum(Individualamount)|difference(TA-IA)|%of diff| |100|1000 |900 |100 |10 | |101|500 |500 |0 |0 |





Aucun commentaire:

Enregistrer un commentaire