(to_number(to_char(cc.printtime,'hh24'))*60 + to_number(to_char(cc.printtime,'mi'))) - (to_number(to_char(log.eventtime,'hh24'))*60 + to_number(to_char(log.eventtime,'mi'))) >0
max( (to_number(to_char(cc.printtime,'hh24')) * 60 + to_number(to_char(cc.printtime,'mi'))) - (to_number(to_char(log.eventtime,'hh24')) * 60 + to_number(to_char(log.eventtime,'mi'))) ) "minutes"
((max(cc.printtime - log.eventtime)) * 1440) "minutes"
SELECT to_char(cc.printtime,'DD.MM.YYYY') "date", sp.article, sp.docid, ((max(cc.printtime - log.eventtime)) * 1440) "minutes", to_char(log.eventtime,'hh24:mi:ss') "change_price_time", to_char(cc.printtime,'hh24:mi:ss') "check_time", sp.itemprice "Price", cci.itemprice "check_price" FROM SUPERMAG.Smspec sp, SUPERMAG.Smdoclog log, SUPERMAG.Smcashchecks cc, SUPERMAG.Smcashcheckitems cci where log.doctype='AC' and log.oldstate=2 and log.newstate=3 and log.id=sp.docid and sp.article=cci.article and cc.desknum=cci.desknum and cc.znum=cci.znum and cc.checknum=cci.checknum and to_char(cc.printtime,'DD.MM.YYYY') =to_char(log.eventtime,'DD.MM.YYYY') and cci.itemprice<>sp.itemprice and (cc.printtime - log.eventtime) < 1 and cc.printtime>log.eventtime group by sp.article, sp.docid, log.eventtime, cc.printtime, cci.itemprice, sp.itemprice
to_char(cc.printtime,'DD.MM.YYYY') =to_char(log.eventtime,'DD.MM.YYYY') and
(cc.printtime - log.eventtime) > 0