Fixed query 2
This commit is contained in:
parent
ddb2505d9f
commit
b36213a58d
@ -27,17 +27,20 @@ db.Employee.aggregate([
|
||||
2. Find Employee with Total Salary for Each City with Designation "Developer":
|
||||
```mongodb
|
||||
db.Employee.aggregate([
|
||||
{
|
||||
$match: { Designation: "Developer" }
|
||||
},
|
||||
{
|
||||
$group: {
|
||||
_id: { $arrayElemAt: ["$Address.PAddr", 0] },
|
||||
TotalSalary: { $sum: "$Salary" }
|
||||
}
|
||||
{
|
||||
$match: {
|
||||
Designation: "Developer"
|
||||
}
|
||||
},
|
||||
{
|
||||
$group: {
|
||||
_id: "$Address.PAddr",
|
||||
Total: { $sum: "$Salary" }
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
```
|
||||
|
||||
3. Find Total Salary of Employee with Designation "Tester" for Each Company:
|
||||
|
Loading…
Reference in New Issue
Block a user