Advertisement

08.18.2007 at 02:11AM PDT, ID: 22771412
[x]
Attachment Details

SQL query of oracle

Asked by Asmitagoyal in Oracle Database, Oracle 9.x

Tags: oracle, sql, query, datestamp, timestamp

SELECT  a.DATESTAMP DATESTAMP ,(NVL(A.X,0)+ NVL(b.Y,0)) QtySum
             FROM  (SELECT DATESTAMP,sum(proddata) X FROM  Tabel1
             where    
             datestamp >='14-aug-2007'  and   datestamp <= '17-aug-2007' and
              timestamp >=84 group by datestamp)A,
              (SELECT DATESTAMP,sum(proddata) Y FROM  Tabel1  where
                  datestamp >= '14-aug-2007' and   datestamp <= '17-aug-2007' and
               timestamp <24 group by datestamp)B   where b.datestamp(+)=a.datestamp+1


i have above query and in table i have data like

DateStamp                      TimeStamp                   ProdData
15-aug-2007                           1                             100
..                                              2--79
15-aug-2007                           84                           100
16-aug-2007                            1                             200
..
16-aug-2007                            86                           200

The result coming as

16-aug-2007                600


Expected result is
14-aug-2007                2400                                   ( 1 to 24 of 15 aug)    
15-aug-2007                 4900                                  (84 of 15 aug and 1-24 of 16 aug)
16-aug-2007                   600                                 (84 to26 of 16 aug)




how to modify the query





Start Free Trial
 
Loading Advertisement...
 
[+][-]08.18.2007 at 02:20AM PDT, ID: 19722100

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.18.2007 at 04:31AM PDT, ID: 19722303

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.19.2007 at 10:21PM PDT, ID: 19728359

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2007 at 01:59AM PDT, ID: 19728952

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2007 at 05:09AM PDT, ID: 19745288

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.31.2007 at 09:11AM PDT, ID: 20186726

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]11.04.2007 at 02:01PM PST, ID: 20212501

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Oracle Database, Oracle 9.x
Tags: oracle, sql, query, datestamp, timestamp
Sign Up Now!
Solution Provided By: Computer101
Participating Experts: 4
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628