phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Taylor <jamestay...@apache.org>
Subject Re: How to create a view with case
Date Mon, 21 Dec 2015 20:54:53 GMT
You'd need to create multiple views, one for each metric_type:

CREATE VIEW mobile_product_metrics (new_col1 varchar) AS SELECT * FROM
product_metrics WHERE metric_type = 'm';

CREATE VIEW phone_product_metrics (new_col2 varchar) AS SELECT * FROM
product_metrics WHERE metric_type = 'p';

On Monday, December 21, 2015, Afshin Moazami <Afshin.Moazami@guavus.com>
wrote:

> I am trying to create a view on a table in Apache Phoenix and add/change
> the values of one of the base table columns in the view.
>
> Something like this:
>
> CREATE VIEW mobile_product_metrics (new_col varchar) AS
> SELECT * ,
> (CASE metric_type WHEN 'm' THEN 'mobile'
> WHEN 'p' THEN 'phone'
> ELSE 'unknown' END ) AS new_col
> FROM product_metrics;
>
> I am wondering if this is supported by Phoenix.
>

Mime
View raw message