How to use CASE WHEN to don't show the field that not match condition

n1ql
#1

As docs says:

SELECT
  CASE WHEN `shipped-on`
  IS NOT NULL THEN `shipped-on`
  ELSE "not-shipped-yet"
  END
  AS shipped
  FROM orders

This N1QL will result:

{ "shipped": "2013/01/02" },
{ "shipped": "2013/01/12" },
{ "shipped": "not-shipped-yet" },

I want to know how to only show shipped filed that match condition . such as

{ "shipped": "2013/01/02" },
{ "shipped": "2013/01/12" },

That the field do not match condition don’t show null,just missing it.
where my condition might be a little complex.

#2

Change to this… use MISSING to have a field go missing :wink:

SELECT
CASE WHEN shipped-on
IS NOT NULL THEN shipped-on
ELSE MISSING
END
AS shipped
FROM orders

#3

Thank you very much,It works.