mWorker

Average task expenses by department

SQL query for mWorker

Calculate the average task expenses for each department.

SELECT Departments.name, AVG(TaskExpenseTypes.amount) FROM Departments JOIN Employees ON Departments.id = Employees.department_id JOIN Tasks ON Employees.id = Tasks.employee_id JOIN TaskExpenseTypes ON Tasks.id = TaskExpenseTypes.task_id GROUP BY Departments.name

mWorker data model

mWorker
Table Customer Contacts

mWorker
Table Customers

mWorker
Table Departments

mWorker
Table Employees

mWorker
Table Locations

mWorker
Table Order Notes

mWorker
Table Order Participants

mWorker
Table Positions

mWorker
Table Product Types

mWorker
Table Projects

mWorker
Table Suppliers

mWorker
Table Tags

mWorker
Table Tasks

mWorker
Table Task Hour Types

mWorker
Table Task Expense Types

mWorker
Table Terminals

mWorker
Table Terminal Transactions

mWorker
Table Transport Sites

mWorker
Table Users

mWorker
Table Vehicles

mWorker
Table Contacts

mWorker
Table Product Registration

mWorker
Table Deliveries

mWorker
Table Orders

Use SQL on all your SaaS data

Magical SQL for mWorker with Peliqan.io

Explore data in a rich spreadsheet UI. Use Magical SQL to combine and transform data. SQL queries become new tables that can be shared with business users and used in any BI tool such as Microsoft Power BI, Tableau or Metabase.

Let AI do the work for you

Peliqan’s AI assistant helps you to write SQL queries to get to insights fast. Ask your question in plain English and immediately see the result in Peliqan’s rich spreadsheet viewer.

Peliqan Ask AI willl write your SQL queries from plain English