Добрый день!
Твой селект очень быстро работает - 13 секунд! Можно сказать влет. Убери из подселектов клаузу "ORDER BY" - сам убедишься.
SELECT SMSTORELOCATIONS_NAME as "Место хранения",
SACARDCLASS.TREE as "Код узла",
SACARDCLASS.NAME as "Классификатор",
SMCASHCHECKITEMS_ARTICLE as "Артикул",
SMCARD.NAME as "Наименование товара",
SUM(SMCASHCHECKITEMS_TOTALSUM) as "Общая сумма по артикулу",
TIME_INTERVAL as "Интервал"
FROM (
SELECT SMSTORELOCATIONS.NAME as SMSTORELOCATIONS_NAME,
SMCASHCHECKS.CHECKNUM as SMCASHCHECKS_CHECKNUM,
SMCASHCHECKS.PRINTTIME as SMCASHCHECKS_PRINTTIME,
SMCASHCHECKS.ZNUM as SMCASHCHECKS_ZNUM,
SMCASHZ.DESKNUM as SMCASHZ_DESKNUM,
SMCASHZ.CLOSEDATE as SMCASHZ_CLOSEDATE,
('с &DatBeg по &DatEnd') as TIME_INTERVAL
FROM SMCASHCHECKS,
SMSTORELOCATIONS,
SMCASHZ
WHERE SUBSTR(SMCASHCHECKS.PRINTTIME, 0, 10) >=
to_date('&DatBeg', 'DD.MM.YYYY')
AND SUBSTR(SMCASHCHECKS.PRINTTIME, 0, 10) <=
to_date('&DatEnd', 'DD.MM.YYYY')
AND SMCASHCHECKS.OPCODE IN(1)
AND SMSTORELOCATIONS.ID = SMCASHCHECKS.LOCID
AND SMCASHCHECKS.ZNUM = SMCASHZ.ZNUM
AND SMCASHZ.LOCID = SMCASHCHECKS.LOCID
AND SMCASHCHECKS.DESKNUM = SMCASHZ.DESKNUM
AND SUBSTR(SMCASHZ.CLOSEDATE, 0, 10) >=
to_date('&DatBeg', 'DD.MM.YYYY')
AND SUBSTR(SMCASHZ.CLOSEDATE, 0, 10) <=
to_date('&DatEnd', 'DD.MM.YYYY')
GROUP BY SMSTORELOCATIONS.NAME,
SMCASHCHECKS.CHECKNUM,
SMCASHCHECKS.PRINTTIME,
SMCASHCHECKS.ZNUM,
SMCASHZ.DESKNUM,
SMCASHZ.CLOSEDATE
),
(
SELECT SMSTORELOCATIONS.NAME as SMSTORELOCATIONS_NAME_1,
SMCASHCHECKITEMS.CHECKNUM as SMCASHCHECKITEMS_CHECKNUM,
SMCASHCHECKITEMS.ARTICLE as SMCASHCHECKITEMS_ARTICLE,
(SMCASHCHECKITEMS.TOTALSUM) as
SMCASHCHECKITEMS_TOTALSUM,
SMCASHCHECKITEMS.ZNUM as SMCASHCHECKITEMS_ZNUM,
SMCASHZ.DESKNUM as SMCASHZ_DESKNUM_1,
SMCASHZ.CLOSEDATE as SMCASHZ_CLOSEDATE_1
FROM SMCASHCHECKITEMS,
SMSTORELOCATIONS,
SMCASHZ
WHERE SMSTORELOCATIONS.ID = SMCASHCHECKITEMS.LOCID
AND SMCASHCHECKITEMS.ZNUM = SMCASHZ.ZNUM
AND SMCASHCHECKITEMS.DESKNUM = SMCASHZ.DESKNUM
AND SMCASHZ.LOCID = SMCASHCHECKITEMS.LOCID
AND SUBSTR(SMCASHZ.CLOSEDATE, 0, 10) >=
to_date('&DatBeg', 'DD.MM.YYYY')
AND SUBSTR(SMCASHZ.CLOSEDATE, 0, 10) <=
to_date('&DatEnd', 'DD.MM.YYYY')
GROUP BY SMSTORELOCATIONS.NAME,
SMCASHCHECKITEMS.ARTICLE,
SMCASHCHECKITEMS.TOTALSUM,
SMCASHCHECKITEMS.CHECKNUM,
SMCASHCHECKITEMS.ZNUM,
SMCASHZ.DESKNUM,
SMCASHZ.CLOSEDATE
),
SACARDCLASS,
SMCARD
WHERE SMSTORELOCATIONS_NAME = SMSTORELOCATIONS_NAME_1
AND SACARDCLASS.ID = SMCARD.IDCLASS
AND SMCARD.ARTICLE = SMCASHCHECKITEMS_ARTICLE
AND SMCASHCHECKS_CHECKNUM = SMCASHCHECKITEMS_CHECKNUM
AND SMCASHCHECKS_ZNUM = SMCASHCHECKITEMS_ZNUM
AND SMCASHZ_DESKNUM = SMCASHZ_DESKNUM_1
AND SMCASHZ_CLOSEDATE = SMCASHZ_CLOSEDATE_1
GROUP BY SMSTORELOCATIONS_NAME,
SACARDCLASS.TREE,
SACARDCLASS.NAME,
SMCASHCHECKITEMS_ARTICLE,
SMCARD.NAME,
TIME_INTERVAL
ORDER BY SMCASHCHECKITEMS_ARTICLE
С Уважением Владимир.