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

334
Views
MySQL date_format(fecha, '%Y-%m-%d %h') como equivalente de 'día-hora' en Presto

Tengo columna de fecha de columna, tipo de datos de marca de tiempo.

 date '2020-08-05 01:01:24.000' '2020-08-05 02:02:24.000' '2020-08-05 02:03:24.000'

Quiero agrupar por día-horas.

Así que en MySQL haría esto por

 select date_format( date, '%Y-%m-%d %h') as `day-hour` from table group by date_format( date, '%Y-%m-%d %h');

que daría salida:

 day-hour 2020-08-05 01 2020-08-05 02

¿Cómo puedo hacer esto en Presto?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede convertir esas cadenas en TIMESTAMP y usar date_trunc para truncar las marcas de tiempo en horas:

 WITH data(x) AS (VALUES '2020-08-05 01:01:24.000', '2020-08-05 02:02:24.000', '2020-08-05 02:03:24.000') SELECT date_trunc('hour', CAST(x AS TIMESTAMP)) FROM data GROUP BY 1
 _col0 ------------------------- 2020-08-05 01:00:00.000 2020-08-05 02:00:00.000 (2 rows)
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!