Rewrite the title: SQL statement using WHERE clause of CASE statement
P粉969253139
2023-08-10 14:13:39
<p>
I was struggling with how to get p.oldversionref as output when writing the second statement when I need p.voided_date_key equal to 11082023. </p><p><br /></p>
<pre><code> select * from table1 as p
in
1 = (determined when p.accepted_date_key > '11082023'
Then 1
When p.voided_date_key = '11082023'
Then p.oldversionref then 1)
/code> </code></pre>
<code>
<p><br /></p></code>
Based on the information given, maybe this version may help: