如果平均年龄> 61然后状态值正常,否则在HIve中不行

时间:2016-12-03 18:28:53

标签: hive hiveql

<div id="myMatch" ng-repeat="n in [].constructor(nbstore+1) track by $index"  ng-if="nbstore">
    <h5> {{$storage[$index]}}</h5> 
    <label class="toggle" ng-model="myMatchsCtrl" ng-click="deleteMyMatch($storage[$index])">
        <input type="checkbox" checked ng-click="reloadPage()"/>
        <div class="track">
            <div class="handle"></div>
        </div>
    </label> 
</div>

需要在Hive中以上述顺序获取输出

1 个答案:

答案 0 :(得分:0)

HQL

    SELECT a.dept,
           age,
           CASE
             WHEN a.age > 61 THEN 'OK'
             ELSE 'Not Ok'
           END AS age
    FROM   (SELECT dept,
                   Avg(age) age
            FROM   avgq
            GROUP  BY dept) a;