1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] date_part in sql to determin age in days without weekend

Discussão em 'Outras Linguagens' iniciado por Stack, Julho 23, 2021.

  1. Stack

    Stack Membro Participativo

    I used the resource here to create a Date calendar. https://duffn.medium.com/creating-a-date-dimension-table-in-postgresql-af3f8e2941ac

    this gives me a weekend_indr column per day. I dont know how to link this to another table where I am subtracting 2 dates. I see a few resources online on how to create a table but nothing on linking it to the inital table to subtract without weekends.

    my current query:

    select
    rental_date,
    return_date,
    DATE_PART('day', return_date - rental_date) as age
    from rental;


    both rental and return date are "TIMESTAMP(6) WITHOUT TIME ZONE" Any help here would be appreciated.

    Continue reading...

Compartilhe esta Página