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 Costs Coststype

Simplicate
Table Costs Expense

Simplicate
Table Crm Contactperson

Simplicate
Table Crm Country

Simplicate
Table Crm Debtor

Simplicate
Table Crm Document

Simplicate
Table Crm Gender

Simplicate
Table Crm Industry

Simplicate
Table Crm Interests

Simplicate
Table Crm Organization

Simplicate
Table Crm Person

Simplicate
Table Crm Relationtype

Simplicate
Table Customfields Model

Simplicate
Table Documents Document

Simplicate
Table Documents Document Type

Simplicate
Table Hours Approval

Simplicate
Table Hours Hours

Simplicate
Table Hours Hourstype

Simplicate
Table Hrm Absence

Simplicate
Table Hrm Civilstatus

Simplicate
Table Hrm Contract

Simplicate
Table Hrm Employee

Simplicate
Table Hrm Leave

Simplicate
Table Hrm Team

Simplicate
Table Hrm Timetable

Simplicate
Table Invoices Document

Simplicate
Table Invoices Invoice

Simplicate
Table Invoices Payment

Simplicate
Table Invoices Proposition

Simplicate
Table Invoices Vatclass

Simplicate
Table Projects Assignment

Simplicate
Table Projects Document

Simplicate
Table Projects Project

Simplicate
Table Projects Project Customfields

Simplicate
Table Projects Purchasetype

Simplicate
Table Projects Service

Simplicate
Table Sales Sales

Simplicate
Table Sales Salesprogress

Simplicate
Table Sales Salessource

Simplicate
Table Sales Service

Simplicate
Table Services Defaultservice

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.

Peliqan Ask AI willl write your SQL queries from plain English

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.