Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
oseimuduame
Creator II
Creator II

Double Qty Persists

Good Afternoon,

i had an issue some months Back and i got a response.

The issue is that i was experiencing Double Qty some times back and i used DISTINCT to correct this and it worked for sometime only for me to realize now that there are still some occurences of the Duplicate item qty.

Please any idea on how to resolve this.

//inventory qty

SQL SELECT DISTINCT

  TO_CHAR(q.ITEM_SID) AS "ITEM_SID",

  q.SBS_NO AS "SBS_NO",

  q.STORE_NO AS "STORE_NO",

  q.QTY as "OH_QTY",

  q.MIN_QTY as "MIN_QTY",

  q.MAX_QTY as "MAX_QTY",

   q.TRANSFER_IN_QTY as "TRANS_IN",

  q.TRANSFER_OUT_QTY as "TRANS_OUT",

  (n.COST * q.QTY) AS "EXT_COST"

FROM INVN_SBS_QTY q

INNER JOIN INVN_SBS n ON n.ITEM_SID = q.ITEM_SID

WHERE q.STORE_NO < 250 AND q.SBS_NO in $(subsidiaries);

Thank You.

10 Replies
sasiparupudi1
Master III
Master III

Where do you see the double qty in which field? this looks like asql issue rather than a qlikview issue

fvelascog72
Partner - Specialist
Partner - Specialist

Hi,

Maybe duplicated values in INVN_SBS?

Saludos

shiveshsingh
Master
Master

Is your data in INVN_SBS_QTY and INVN_SBS is unique?

Are you facing issue after join?

oseimuduame
Creator II
Creator II
Author

I am seeing the Double Qty in the INVN_SBS_QTY which means that for most of the Items the QTY is double e.g 7 will become 14. This was why i used distinct but still experiencing the double qty

oseimuduame
Creator II
Creator II
Author

The DB cannot hold Double Values i have double Checked. I picked on item and i checked the QTY on the Software and Compare to Qlikview it still Duplicating.

Any help please.

oseimuduame
Creator II
Creator II
Author

Yes the Data are UNIQUE..

And i think the Duplicate comes after Joining.

Any help please

shiveshsingh
Master
Master

Then there can be an issue in joining. May be one value is getting joined to 2 values in another table.

Need to debug!

Can you share your app?

qv_testing
Specialist II
Specialist II

I think you have one to many relation.

may be data repeating twice.

Table1:

IDAmount
100200
200300
300400

Table2:

IDCategory
100A
100B
200C
300R
300R

If we use inner join data repeats, because we have one to many...Ab.JPG

Instead of Inner Join use Inner Keep.  (Convert into Qlikview)

Ab.JPG

I think your query is simple, better to convert into Qlikview, and use left Keep.

that would work.

Thanks....!

oseimuduame
Creator II
Creator II
Author

I tried this script but keep saying Missing Keyword...

//inventory qty

SQL SELECT

  TO_CHAR(q.ITEM_SID) AS "ITEM_SID",

  q.SBS_NO AS "SBS_NO",

  q.STORE_NO AS "STORE_NO",

  q.QTY as "OH_QTY",

  q.MIN_QTY as "MIN_QTY",

  q.MAX_QTY as "MAX_QTY",

   q.TRANSFER_IN_QTY as "TRANS_IN",

  q.TRANSFER_OUT_QTY as "TRANS_OUT",

  (n.COST * q.QTY) AS "EXT_COST"

FROM INVN_SBS_QTY q

LEFT KEEP INVN_SBS n ON n.ITEM_SID = q.ITEM_SID

WHERE q.STORE_NO < 250 AND q.SBS_NO in $(subsidiaries);

Am i missing something here