I tried sql qurey for this as below
SELECT “store”.“Product” AS “Material Name”, ( SELECT SUM( “store”.“Quantity” ) AS “Quantity” FROM “store”, “store_filter1” WHERE “store”.“Type” = ‘Recieved’ AND ( ( ( UPPER ( “store”.“Product” ) LIKE ‘%’ || UPPER ( “store_filter1”.“Product” ) || ‘%’ ) OR ( “store_filter1”.“Product” IS NULL ) ) AND ( ( ( “store_filter1”.“Date2” IS NULL ) ) OR ( ( “store”.“Date” < “store_filter1”.“Date” ) ) ) ) GROUP BY “store”.“Product” ) - ( SELECT SUM( “store”.“Quantity” ) AS “Quantity” FROM “store”, “store_filter1” WHERE “store”.“Type” = ‘Issue’ AND ( ( ( UPPER ( “store”.“Product” ) LIKE ‘%’ || UPPER ( “store_filter1”.“Product” ) || ‘%’ ) OR ( “store_filter1”.“Product” IS NULL ) ) AND ( ( ( “store_filter1”.“Date” IS NULL ) ) OR ( ( “store”.“Date” < “store_filter1”.“Date” ) ) ) ) GROUP BY “store”.“Product” ) AS “Pre Bal.”, ( SELECT SUM( “store”.“Quantity” ) AS “Quantity” FROM “store”, “store_filter1” WHERE “store”.“Type” = ‘Recieved’ AND ( ( ( UPPER ( “store”.“Product” ) LIKE ‘%’ || UPPER ( “store_filter1”.“Product” ) || ‘%’ ) OR ( “store_filter1”.“Product” IS NULL ) ) AND ( ( ( “store_filter1”.“Date” IS NULL ) AND ( “store_filter1”.“Date2” IS NULL ) ) OR ( ( “store”.“Date” >= “store_filter1”.“Date” ) AND ( “store”.“Date” <= “store_filter1”.“Date2” ) ) ) ) GROUP BY “store”.“Product” ) AS “Recieved Bal.”, ( SELECT SUM( “store”.“Quantity” ) AS “Quantity” FROM “store”, “store_filter1” WHERE “store”.“Type” = ‘Issue’ AND ( ( ( UPPER ( “store”.“Product” ) LIKE ‘%’ || UPPER ( “store_filter1”.“Product” ) || ‘%’ ) OR ( “store_filter1”.“Product” IS NULL ) ) AND ( ( ( “store_filter1”.“Date” IS NULL ) AND ( “store_filter1”.“Date2” IS NULL ) ) OR ( ( “store”.“Date” >= “store_filter1”.“Date” ) AND ( “store”.“Date” <= “store_filter1”.“Date2” ) ) ) ) GROUP BY “store”.“Product” ) AS “Issue Bal.”, ( SELECT SUM( “store”.“Quantity” ) AS “Quantity” FROM “store”, “store_filter1” WHERE “store”.“Type” = ‘Recieved’ AND ( ( ( UPPER ( “store”.“Product” ) LIKE ‘%’ || UPPER ( “store_filter1”.“Product” ) || ‘%’ ) OR ( “store_filter1”.“Product” IS NULL ) ) AND ( ( ( “store_filter1”.“Date2” IS NULL ) ) OR ( ( “store”.“Date” <= “store_filter1”.“Date2” ) ) ) ) GROUP BY “store”.“Product” ) - ( SELECT SUM( “store”.“Quantity” ) AS “Quantity” FROM “store”, “store_filter1” WHERE “store”.“Type” = ‘Issue’ AND ( ( ( UPPER ( “store”.“Product” ) LIKE ‘%’ || UPPER ( “store_filter1”.“Product” ) || ‘%’ ) OR ( “store_filter1”.“Product” IS NULL ) ) AND ( ( ( “store_filter1”.“Date2” IS NULL ) ) OR ( ( “store”.“Date” <= “store_filter1”.“Date2” ) ) ) ) GROUP BY “store”.“Product” ) AS “Post Bal.”, ( SELECT SUM( “store”.“Quantity” ) AS “Quantity” FROM “store”, “store_filter1” WHERE “store”.“Type” = ‘Recieved’ AND ( ( ( UPPER ( “store”.“Product” ) LIKE ‘%’ || UPPER ( “store_filter1”.“Product” ) || ‘%’ ) OR ( “store_filter1”.“Product” IS NULL ) ) ) GROUP BY “store”.“Product” ) - ( SELECT SUM( “store”.“Quantity” ) AS “Quantity” FROM “store”, “store_filter1” WHERE “store”.“Type” = ‘Issue’ AND ( ( ( UPPER ( “store”.“Product” ) LIKE ‘%’ || UPPER ( “store_filter1”.“Product” ) || ‘%’ ) OR ( “store_filter1”.“Product” IS NULL ) ) ) GROUP BY “store”.“Product” ) AS “Present Bal.” FROM “store”, “store_filter1” WHERE ( UPPER ( “store”.“Product” ) LIKE ‘%’ || UPPER ( “store_filter1”.“Product” ) || ‘%’ ) OR ( “store_filter1”.“Product” IS NULL ) GROUP BY “store”.“Product”
its works fine for on single item selection through combo box but when for all item then error cardinality violation. suggestion for improvemet to get this result multiitem
material Name Pre Bal Recived Bal Issue Bal Post Bal Present Bal
A 10 20 5 25 10
Suppose material is Jan to April, selected period Feb so Pre Bal is before Feb … Recived Bal and Issue Bal of Feb… Post Bal after Feb and Present Bal after April
may my sql qurey is drafted complex.
some suggestion can be converted to results as desired for multi selection of item at time