我在postgreSQL9.3中有数据库表名称emp_leave,例如
INSERT
答案 0 :(得分:2)
您要聚合:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div><br>
<textarea id="postText" class="form-control" placeholder="No que você está pensando?"></textarea>
<div class="btn-toolbar" role="toolbar">
<div class="btn-group" role="group">
<button id="foto" class="btn btn-primary"><span class="fa fa-camera"></span> Adicionar Foto</button>
<button id="texto" class="btn btn-primary"><span class="fa fa-pencil-square-o"></span> Texto</button>
</div>
<button class="btn btn-success" style="float:right;"><span class="fa fa-paper-plane"></span> Enviar</button>
</div>
<form enctype="multipart/form-data" method="POST" action="#" class="fotoForm">
<input type="file" name="foto" id="fotoInput" style="display:none; visibility:hidden;">
</form>
这假定空白为select el.emp_name, el.department,
max(el.ann_leave),
. . . ,
max(el.org_cas_lv)
from emp_leave el
group by el.emp_name, el.department;
。
答案 1 :(得分:2)
要消除空值并转换为单行
select
emp_name,
department,
min(ann_leave),
min(med_leave),
min(cas_leave),
min(org_ann_lv),
min(org_med_lv),
min(org_cas_lv)
from emp_leave
group by
emp_name,
department