从行中删除null或零列值

从行中删除null或零列值

本文介绍了从行中删除null或零列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! ReqColumns | hostid | 总内存 |总内存[免费] |总内存[已使用] RAM 10093 15 0 0 RAM 10093 0 11 0 RAM 10093 0 0 4 如何编写选择查询以获得以下输出 ReqColumns | hostid | 总内存 |总记忆[免费] |总记忆[已使用] RAM 10093 15 11 4 请帮帮我... 如果已经回答请给我链接 提前致谢ReqColumns|hostid|Total Memory|Total Memory[Free]|Total Memory[used]RAM100931500RAM100930110RAM10093004How to write a select query for getting the below outputReqColumns|hostid|Total Memory|Total Memory[Free]|Total Memory[used]RAM1009315114Please help me...if already answered please give me the linksThanks 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或零列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-11 23:12