wrote an attempt in oracle. I want to add a field to get the QTYGOOD and
of the same RD.SKU line. CREATE OR REPLACE VIEW aaa AS
SELECT
R.WHSEID,
RD.STORERKEY,
RD.SKU,
CASE
WHEN LOC.LOCATIONCATEGORY <> "NG" AND RD.CONDITIONCODE = "OK"
THEN RD.QTYRECEIVED
ELSE 0
END QTYGOOD
FROM RECEIPT R
LEFT JOIN RECEIPTDETAIL RD ON R.RECEIPTKEY = RD.RECEIPTKEY
LEFT JOIN RECEIPTDETAIL RD1 ON RD1.RECEIPTKEY = SUBSTR (RD.LOTTABLE03,1,10)
AND RD1.RECEIPTLINENUMBER = SUBSTR(RD.LOTTABLE03,11,5)
LEFT JOIN SKU SKU ON SKU.STORERKEY = RD.STORERKEY
AND SKU.SKU = RD.SKU
LEFT JOIN STORER S ON S.STORERKEY = RD.STORERKEY
AND S.TYPE="1"
LEFT JOIN STORER S1 ON S1.STORERKEY = RD.LOTTABLE06
AND S1.TYPE="1"
LEFT JOIN CODELKUP C ON C.CODE = R.TYPE
AND C.LISTNAME="RECEIPTYPE"
LEFT JOIN CODELKUP C1 ON C1.CODE = RD.LOTTABLE11
AND C1.LISTNAME="ISOCOUNTRY"
LEFT JOIN CODELKUP C2 ON C2.CODE = R.CUSTOMWAY
AND C2.LISTNAME="CUSTOMWAY"
LEFT JOIN LOC LOC ON LOC.LOC = RD.TOLOC
LEFT JOIN ALTSKU An ON A.STORERKEY = RD.STORERKEY AND A.SKU = RD.SKU
AND A.VENDOR = RD.LOTTABLE06 AND A.ALTSKU = RD.LOTTABLE07
AND A.UDF7 = RD.LOTTABLE08 AND A.UDF8 = RD.LOTTABLE09
WHERE R.Stats = "11" AND RD.QTYRECEIVED > 0