We help IT Professionals succeed at work.
Get Started

how to implement sub queries in webi

1,320 Views
Last Modified: 2013-11-15
I have this query and I want to know the procedure/steps to be followed in implementing this sql in webi , below is sql, basically what i have done is without taking the sub-query i have just taken the count(c1.no) and min(c1.dt) without including the min(c2.dt) but it gives me the error as invlaid column type for second column where we the count(c1.no) .... can anyone please help me with this process as how i could implement it ... would greatly appreciate your help !

thanks in advance for your time

SELECT
  D6.DS,                        
  COUNT(C1.NO),                        
  MIN(C1.DT-(SELECT MIN(C2.DT)
        FROM C2
        WHERE C1.NO  =  C2.NO
        AND C2.ST  =  700
        GROUP BY C1.NO)),       
  MAX(C1.DT-(SELECT MIN(C2.DT)
        FROM C2
        WHERE C1.NO  =  C2.NO
        AND C2.ST  =  700
        GROUP BY C1.NO)),            
  AVG(C1.DT-(SELECT MIN(C2.DT)
        FROM C2
        WHERE C1.NO  =  C2.NO
        AND C2.ST  =  700
        GROUP BY C1.NO))            
FROM
  C1,
  D4,
  D6
WHERE
       C1.TM  =  D4.EM
   AND D4.TT <> 'JIK'
   AND D4.TT  =  D6.TT
GROUP BY
  D6.DS
ORDER BY
  D6.DS
Comment
Watch Question
Data Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 20 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE