Rewrite the title: SQL statement using WHERE clause of CASE statement
P粉969253139
P粉969253139 2023-08-10 14:13:39
0
1
456
<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>
P粉969253139
P粉969253139

reply all(1)
P粉561438407

Based on the information given, maybe this version may help:

SELECT *
FROM table1 AS p
WHERE
    (CASE
        WHEN p.accepted_date_key > '11082023' THEN 1
        WHEN p.voided_date_key = '11082023' THEN p.oldversionref
        ELSE 0
    END) = 1;
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template