Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
Registros únicos trimestre a trimestre

yo tengo una mesa asi -

 patient_id date org I5434 2020-06-05 Methodist Hospital ertw4 2020-08-03 New York Hospital ouiku35 2020-08-30 Tristar ouiku35 2020-01-05 Tristar ouiku35 2020-04-22 Tristar

La salida que necesito es

 quarter count 2020Q1 1 2020Q2 1 2020Q3 1

El tercer registro en la tabla anterior no se cuenta porque es el mismo paciente en trimestres anteriores en el mismo hospital

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Podemos intentar usar un enfoque de tabla de calendario aquí:

 WITH quarters AS ( SELECT 2020 AS year, 1 AS quarter, '2020Q1' AS label UNION ALL SELECT 2020, 2, '2020Q2' UNION ALL SELECT 2020, 3, '2020Q3' UNION ALL SELECT 2020, 4, '2020Q4' ) SELECT q.label, COUNT(t.date) AS count FROM quarters q LEFT JOIN yourTable t ON EXTRACT(year FROM t.date) = q.year AND EXTRACT(quarter FROM t.date) = q.quarter GROUP BY q.label ORDER BY q.label;

captura de pantalla del enlace de demostración a continuación

Manifestación

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!