如何在MySql Workbench中隐藏空行

时间:2017-12-14 12:56:59

标签: mysql mysql-workbench

目前我正在使用MySQL PHP for MySQL,我正在使用MySQL Workbench工具,它看起来不错,但我有一个小问题,(因为我仍然是MySQL管理员的新手级别)

这是我写的代码

SELECT
    sku,
    SUM(IF(transaction_type = 'order' AND amount_description = 'Principal' AND amount_type = 'ItemPrice',amount,0)) AS 'Total_Order',
    SUM(IF(transaction_type = 'order' AND amount_description = 'Principal' AND amount_type = 'ItemPrice', quantity_purchased,0)) AS 'Total_QTY_Order',
    SUM(IF(amount_type = 'FBA Inventory Reimbursement' AND amount_description = 'REVERSAL_REIMBURSEMENT',amount,0)) AS 'Total_Reimbursement',
    SUM(IF(amount_type = 'FBA Inventory Reimbursement' AND amount_description = 'REVERSAL_REIMBURSEMENT',quantity_purchased,0)) AS 'Total_QTY_Refund'
FROM settlements_qty_test

GROUP BY SKU
ORDER BY Total_Order DESC

结果看起来很好很棒,但有一件事让我恼火,因为你可以看到蓝色的亮点,我如何隐藏这个蓝色高光,因为它是空行。它没什么,因为没有SKU。

enter image description here

我认为这是由于空值或没有空值?

1 个答案:

答案 0 :(得分:1)

GROUP BY语句后,插入过滤条件。也许

  HAVING sku IS NOT NULL AND LENGTH(sku) > 0 

会做到这一点。但很难确定您的遗失sku值是如何实际记录在数据库中的。