"Dmitry Yemanov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Nikolay Trifonov wrote: >> >> ËÁË ÐÒÁ×ÉÌØÎÏ ÅÇÏ ÐÅÒÅÐÉÓÁÔØ > > éÚÂÁ×ÉÔØÓÑ ÏÔ NOT IN. îÁÐÒÉÍÅÒ, × ÐÏÌØÚÕ NOT EXISTS. > > > -- > äÍÉÔÒÉÊ åÍÁÎÏ× > >
óÄÅÌÁÌ, ÄÅÊÓÔ×ÉÔÅÌØÎÏ ÌÕÞÛÅ. ðÏÌÕÞÉÌ ÐÌÁÎ PLAN SORT (JOIN (O INDEX (OPERATIONS_IDX__STATE), D INDEX (RDB$FOREIGN62, DOCUMENTS_IDX), DI INDEX (RDB$FOREIGN21)))SORT (JOIN (G INDEX (RDB$PRIMARY7), P INDEX (RDB$FOREIGN43), PC INDEX (IDX_PRODUCT_CARDS_1), DI INDEX (RDB$PRIMARY4), D INDEX (RDB$PRIMARY3)))(RECURS_GROUPS NATURAL)JOIN (JOIN (DI2 INDEX (RDB$FOREIGN65), D2 INDEX (RDB$PRIMARY3)), O2 INDEX (RDB$PRIMARY8))SORT (JOIN (PC INDEX (RDB$FOREIGN26), P INDEX (RDB$PRIMARY9), G INDEX (RDB$PRIMARY7), DI INDEX (RDB$PRIMARY4), D INDEX (RDB$PRIMARY3))) îÉÞÅÇÏ ÎÅÌØÚÑ ÅÝÅ ÕÌÕÞÛÉÔØ? ôÅËÓÔ ÚÁÐÒÏÓÁ: select p.name as ProductName, sum(pc.rest) as Rest, g.name as GroupName, p.Price_Retail_Val, p.FullName, p.Description, d.Date_Docum from products p, groups g, product_cards pc, docum_items di, documents d where p.id_group=g.id_group and p.id_product=pc.id_product and pc.id_store = :ID_STORE and pc.rest>0 and not exists (select di2.id_product from documents d2, docum_items di2, operations o2 where d2.id_docum = di2.id_docum and d2.id_operation = o2.id_operation and o2.state in (3) and d2.date_docum between :DateBegin and :DateEnd and di2.id_product=p.id_product) and pc.id_docitem = di.id_docitem and di.id_docum = d.id_docum group by p.name, g.name, p.Price_Retail_Val, p.FullName, p.Description, d.Date_Docum