Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: MySQL workbench, How to create a Filter for a Date to arrange a group

Steven Smith:

I am working on the date group. at the moment it doesn't return as anything result. I have tried on different filter or group without date, and it fine and working well but I need to create a group based on date or timestamp.

Here is a code


SELECT
settlement_id,
settlement_start_date,
sku AS 'Settlement_sku',
SUM(IF(transaction_type = 'order'
AND amount_description = 'Principal'
AND amount_type = 'ItemPrice',
quantity_purchased,
0)) AS 'total_QTY_Order'

FROM settlements
Where settlement_start_date ='2017-11-12'
GROUP BY sku
HAVING Settlement_sku IS NOT NULL
AND LENGTH(Settlement_sku) > 0
ORDER BY Settlement_sku ASC

as I get a result on

if I remove where settlement_start_date ='2017-11-12' and change it to Where settlement_id ='7135956892'

and results are working and fine, please see a screenshot

the problem is settlement_start_date is 0000-00-00 so how to get a group without depending on 0000-00-00.

Here is table as you can see three highlights as I want Yellow Highlight group with Blue highlight and ignore all red highlight

If you are not sure what I am talking about then maybe I can explain more



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: MySQL workbench, How to create a Filter for a Date to arrange a group

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×