• 0
Sign in to follow this  
andy995

Utilizar resultado de uma coluna.

Question

Boa noite , como eu faço para utilizar o resultado gerando na linha 4 e 5 nomeado de TMA/TME , eu realizo o calculo de tempo , porem queria adicionar um filtro em ambos pedindo apenas para me retornar os resultados menores que 20 minutos.

 

select cd,
 EXTRACT(MONTH FROM dt_atdt) as Mes,
 EXTRACT(DAY FROM dt_atdt) as Dia,
 
sec_to_time(round(((time_to_sec(HR_FIM_ATDT)-time_to_sec(HR_INC_ATDT))))) AS TMA,
sec_to_time(round(((time_to_sec(HR_INC_ATDT)-time_to_sec(HR_CHGD_AG))))) AS TME
    from tb_tb2_tb3

 where
 cd in ( 1, 2 , 3 ,4)
 and CD_EST_ATDT in(15,40)
 and cd_tip_atdt not in (4)
 and cd_tip_lcl_atdt = 2
 -- and TMA < '00:00:20' (NÃO FUNCIONA)
 -- and TME < '00:00:20' (NÃO FUNCIONA)

 

 


 

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this