select sp.article, sp.doctype, sp.docid, sp.quantity from smspec sp, smcard crd, (select doctype, id from smdocuments where (doctype = 'CS' or doctype = 'CR') and createdat = &date) DC where sp.docID = DC.ID and sp.article = crd.article --and crd.idclass = &grp