(select (count (1) - 1) | | '
The from date_attribute t
Where t.t he_date between trunc (atr. Handle_time + 1) and
Trunc (atr) finish_time)
And t.w orkday_flag='Y')
End as trueDays,
When demand is truedays greater than 0 display truedays less than equal to 0 0, strives for the bosses
CodePudding user response:
Try the following
Case when the select (count (1) - 1)
The from date_attribute t
Where t.t he_date between trunc (atr. Handle_time + 1) and
Trunc (atr) finish_time)
And t.w orkday_flag='Y') & gt; 0 then (select (count (1) - 1)
The from date_attribute t
Where t.t he_date between trunc (atr. Handle_time + 1) and
Trunc (atr) finish_time)
And t.w orkday_flag='Y')
The else 0
End as trueDays,
CodePudding user response:
reference 1st floor RINK_1 response: try the following Case when the select (count (1) - 1) The from date_attribute t Where t.t he_date between trunc (atr. Handle_time + 1) and Trunc (atr) finish_time) And t.w orkday_flag='Y') & gt; 0 then (select (count (1) - 1) The from date_attribute t Where t.t he_date between trunc (atr. Handle_time + 1) and Trunc (atr) finish_time) And t.w orkday_flag='Y') The else 0 End as trueDays, 00921 unexpected ending of SQL commands CodePudding user response:
reference 1st floor RINK_1 response: try the following Case when the select (count (1) - 1) The from date_attribute t Where t.t he_date between trunc (atr. Handle_time + 1) and Trunc (atr) finish_time) And t.w orkday_flag='Y') & gt; 0 then (select (count (1) - 1) The from date_attribute t Where t.t he_date between trunc (atr. Handle_time + 1) and Trunc (atr) finish_time) And t.w orkday_flag='Y') The else 0 End as trueDays, 00921 CodePudding user response:
Statement is not complete, it seems that only part of the CASE was sent the WHEN to come out, realize you need to have the effect of CASE the WHEN, nested carefully CodePudding user response:
reference white apes reply: 3/f Quote: refer to 1st floor RINK_1 response: try the following Case when the select (count (1) - 1) The from date_attribute t Where t.t he_date between trunc (atr. Handle_time + 1) and Trunc (atr) finish_time) And t.w orkday_flag='Y') & gt; 0 then (select (count (1) - 1) The from date_attribute t Where t.t he_date between trunc (atr. Handle_time + 1) and Trunc (atr) finish_time) And t.w orkday_flag='Y') The else 0 End as trueDays, 00921 You put the whole piece of code CodePudding user response:
reference 5 floor RINK_1 reply: Quote: refer to the third floor white apes reply: Quote: refer to 1st floor RINK_1 response: try the following Case when the select (count (1) - 1) The from date_attribute t Where t.t he_date between trunc (atr. Handle_time + 1) and Trunc (atr) finish_time) And t.w orkday_flag='Y') & gt; 0 then (select (count (1) - 1) The from date_attribute t Where t.t he_date between trunc (atr. Handle_time + 1) and Trunc (atr) finish_time) And t.w orkday_flag='Y') The else 0 End as trueDays, 00921 The whole piece of code you posted see direct messages