Simplicate

Number of leaves taken by each employee

SQL query for Simplicate

Get the count of leaves taken by each employee.

SELECT p.first_name || || p.last_name AS employee_name, COUNT(l.id) AS total_leaves_taken FROM persons p INNER JOIN employees e ON p.id = e.person_id LEFT JOIN leaves l ON e.id = l.employee_id GROUP BY e.id

Simplicate data model

Simplicate
Table Persons
Id: String
Note: String
Gender: String
Initials: String
Full_name: String
Gender_id: String
Is_active: Boolean
Address_id: String
Created_at: Date-time
First_name: String
Updated_at: Date-time
Family_name: String
Address_type: String
Avatar_color: String
Date_of_birth: String
Simplicate_url: String
Address_country: String
Avatar_initials: String
Relation_type_id: String
Custom_salutation: String
Address_country_id: String
Family_name_prefix: String
Relation_type_label: String
Address_country_code: String
Use_custom_salutation: Boolean
Timeline_email_address: String

Simplicate
Table Organizations

Simplicate
Table Contactpersons

Simplicate
Table Hours

Simplicate
Table Employees

Simplicate
Table Timetables

Simplicate
Table Leaves

Simplicate
Table Projects

Simplicate
Table Project Services

Simplicate
Table Invoices

Simplicate
Table Sales

Simplicate
Table Genders

Simplicate
Table Hourstypes

Simplicate
Table Leavetypes

Use SQL on all your SaaS data

Magical SQL for Simplicate 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