I want to get sum of estimate quantity from estimates table gropBy material_id. Also want get sum of mprs quantity related to previous query table.

My estimates table is as below

| id | project_id | material_id | estimatequantity |

| 1 | 1 | 1 | 500 |

| 2 | 1 | 2 | 899 |

| 3 | 1 | 1 | 250 |

and my mprs table is as below

id estimate_id mprquantity 1 1 334 2 1 1 3 2 273 4 1 20

now I want to generate below table

material id Estimated mprs 1 750 355 2 899 273

I searched everywhere but failed.

Member Avatar for diafol

This information is very difficult to follow. What is the relationship between the two tables?

Please show this info in standard format and any constraints (Foreign Keys). Which fields (and from which tables) should be in the query?

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.