从行中删除null或零列值 [英] Remove null or zero column values from rows

查看:63
本文介绍了从行中删除null或零列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< td> 总内存
ReqColumns | hostid | |总内存[免费] |总内存[已使用]
RAM 10093 15 0 0
RAM 10093 0 11 0
RAM 10093 0 0 4












如何编写选择查询以获得以下输出





< tbody>





请帮帮我...

如果已经回答请给我链接

提前致谢

ReqColumns | hostid | 总内存 |总记忆[免费] |总记忆[已使用]
RAM 10093 15 11 4
ReqColumns|hostid|Total Memory|Total Memory[Free]|Total Memory[used]
RAM100931500
RAM100930110
RAM10093004






How to write a select query for getting the below output


ReqColumns|hostid|Total Memory|Total Memory[Free]|Total Memory[used]
RAM1009315114



Please help me...
if already answered please give me the links
Thanks in advance

推荐答案

简单地给你的SQL查询一些条件:

Simple give your SQL query some conditions:
SELECT `ReqColumns`, `hostid`, `Total Memory`, `Total Memory[Free]`, `Total Memory[used]`
FROM `YourTable`
GROUP BY `hostid`
HAVING `Total Memory` <> 0 AND `Total Memory[Free]` <> 0 AND `Total Memory[used]` <> 0





这里我使用 HAVING 子句,因为'Total Memory'字段可能由某些聚合函数获得。



Here I used the HAVING clause, since the 'Total Memory' fields may be obtained by some aggregation functions.


这篇关于从行中删除null或零列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆