Steven Smith
Steven Smith

Reputation: 406

how to hide a Blank row in MySql Workbench

At the moment I'm working on the Database PHP for MySQL, I am using on MySQL Workbench tools, it looks great but I have one tiny problem, (as I'm still newbie rank in MySQL administrator)

Here is a code I wrote

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

The results look fine and great but one thing is annoyed me as you can see the blue highlight, How do I hide this blue highlight as it's empty row. it's nothing there as no SKU on it.

enter image description here

I assumed this is due to null value or no null value?

Upvotes: 0

Views: 611

Answers (1)

O. Jones
O. Jones

Reputation: 108676

After your GROUP BY statement, insert a filter criterion. Maybe

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

will do the trick. But it's hard to tell for sure how your missing sku value is actually recorded in the database.

Upvotes: 1

Related Questions