on 10-25-2017 7:57 PM
I have tow queries. Query 1 does not give right result where 2 gives right result.. It is the way I am applying filter on Hub field. Can someone please explain what is wrong with hub filter in Query 2.
First value of hub (GRECAR) belongs to Division value LA and second value of Hub ( VE) belongs to Division Value LV
--Wrong Query
SELECT "CalMonth", SUM("WorkingCapitalPercentSales") AS "WorkingCapitalPercentSales_SUM" FROM "_SYS_BIC"."com.colpal.xc.brof.Backend.Finance/CV_WCPercentSales" WHERE ("Division" = 'LA' or "Division" = 'LV') AND ( "Hub" <> 'GRECAR' or "Hub" <> 'VE') AND "CalYear" = '2018'
GROUP BY "CalMonth" ORDER BY "CalMonth" ASC
--Correct Query SELECT "CalMonth", SUM("WorkingCapitalPercentSales") AS "WorkingCapitalPercentSales_SUM" FROM "_SYS_BIC"."com.colpal.xc.brof.Backend.Finance/CV_WCPercentSales" WHERE ("Division" = 'LA' or "Division" = 'LV') AND ( "Hub" <> 'GRECAR') AND ("Hub" <> 'VE') AND "CalYear" = '2018'
GROUP BY "CalMonth" ORDER BY "CalMonth" ASC
I am not sure what you consider wrong vs right, however, I believe you need to group your Division and Hub query based on the where condition parts.
are you trying to display data within those divisions but not within the Hubs?
or within the divisions and only specific hubs per division -- that is how your desired output may need to be approached
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.