Does anyone how to to write a statement in the 'WHERE' clause that allows you to the option (not the requirement) to use a certain criteria? I have the following query:
SELECT DISTINCT K.CPLWST_0, H.MFGNUM_0, (H.TRKLASTC_0 - 1), I.ITMREF_0, P.ITMDES1_0, I.LOT_0, O.EXTSTUQTY_0, H.CPLQTY_0, (H.CPLQTY_0 / O.EXTSTUQTY_0) * 100 ,H.STU_0, P.ITMWEI_0
FROM x3v6.CICPROD.MFGHEAD H
LEFT OUTER JOIN MFGOPE O ON H.MFGNUM_0 = O.MFGNUM_0
INNER JOIN MFGHEADTRK T ON H.MFGNUM_0 = T.MFGNUM_0
INNER JOIN MFGITM I ON H.MFGNUM_0 = I.MFGNUM_0
INNER JOIN MFGOPETRK K ON H.MFGNUM_0 = K.MFGNUM_0 AND T.MFGTRKNUM_0 = K.MFGTRKNUM_0
LEFT OUTER JOIN ITMMASTER P ON I.ITMREF_0 = P.ITMREF_0
WHERE H.TRKLASTC_0 BETWEEN %1% AND %2% AND K.CPLWST_0 = %3%
ORDER BY (H.TRKLASTC_0 - 1) DESC, I.ITMREF_0 ASC
I want to be able to give the user the option of using this field to search and leaving it blank. Currently it is mandatory to enter this field. Can anyone help me with this?
Thank you!