Re: SQL CASE WHEN THEN ELSE END

Jose Isaias Cabrera <[email protected]>
Newsgroups gmane.comp.db.sqlite.general
Message-ID <VI1P195MB0765817296504875FDB0EB92DE0B0@VI1P195MB0765.EURP195.PROD.OUTLOOK.COM>

Simon Slavin, on Sunday, January 26, 2020 09:59 PM, wrote...
>
> On 27 Jan 2020, at 2:44am, Jose Isaias Cabrera <[email protected]>
> wrote:
>
> > CASE
> >    (
> >          SELECT WYear FROM t2 WHERE pid = a.a
> >    )
> >    WHEN c.WYear = 2020 THEN “YES”
> >    ELSE “NO” END
>
> That's not the structure of a CASE statement.
>
> After CASE comes an expression.
> After WHEN comes another expression.
> If they equal one another, then the the bit after the THEN is returned.
>
> You want something more like
>
> SELECT
>     (CASE WYear WHEN 2020 THEN 'YES' ELSE 'NO' END) AS DIGITAL
>     FROM t2 WHERE pid = a.a
>
> but you'll have to fit this in with how your overall SELECT works.
>
> Sse "The CASE expression" on this page for more details:
>
> <https://sqlite.org/lang_expr.html>

Thanks.

josé
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.