Select Conditional

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc

Poston Mon, 02 Oct 2006 3:54 pm

How to make a select that the difference of a date is > = 28 and < = 120 days show \"s\" 28 > or < if 120 days show \"N\"
Joao Moraes
Location: Botucatu - SP

Poston Mon, 02 Oct 2006 5:37 pm

Can use CASE WHEN. See example below:
Code: Select all
, sysdate-hiredate diferença
, case when sysdate-hiredate >= 28
         OR sysdate-hiredate <= 120 THEN 'S'
       else 'N'
  end campo
from emp
[url = http//www : . glufke . net/oracle/viewtopic php? t = . 12] This topic [/url] explains how to do this without the CASE WHEN.
(PS: was one of the first tips from the forum!)
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?

Return to SQL

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests