SELECT SMSPEC.ARTICLE,SLSPECPACKS.VALIDDATE,SMGOODS.QUANTITY,SMGOODS.STORELOC
FROM SUPERMAG.SMSPEC
INNER JOIN SUPERMAG.SLSPECPACKS ON
SLSPECPACKS.DOCID=SMSPEC.DOCID and
SLSPECPACKS.SPECITEM=SMSPEC.SPECITEM AND
SLSPECPACKS.VALIDDATE < CURRENT_DATE
INNER JOIN SUPERMAG.SMGOODS ON
SMSPEC.ARTICLE=SMGOODS.ARTICLE and
SMGOODS.QUANTITY>'0'