CodingSome CFML Stuffs Me Do

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Ken (SHIELDSIT)   
 To:  Peter (BOUGHTONP)     
38447.75 In reply to 38447.74 
Peter do you have any idea why this isn't working or how I can make it work?

If you look at this query there is a ConsumedVol that sums everything that is 'consumed' and a ProducedVol that sums everything Produced.

I need to also do this for the ConsumedTotal and ProducedTotal. As the query is now I'm getting those numbers, but they are all lumped together. How can I do multiple sums in this query?

code:
SELECT
	ruhID,rudProductID,ruhDescrip,ruhDate,ruhLocationID,rudTotal AS ConsumedTotal,ConsumedVol=(SELECT SUM(ISNULL(rudVolume,0))
FROM
	ProductionDetail
WHERE
	rudID=ruhID
AND
	rudCategory='Consumed'),rudTotal AS ProducedTotal,ProducedVol=(SELECT SUM(ISNULL(rudVolume,0))
FROM
	ProductionDetail
WHERE
	rudID=ruhID
AND
	rudCategory='Produced')
FROM
	ProductionHeader
LEFT JOIN
	ProductionDetail
ON
	ruhID = rudID
WHERE
	ruhID
LIKE
	'%bg%'
AND
	ruhDate
BETWEEN
	'5/1/11'
AND
	'5/31/11'
GROUP BY
	ruhID,ruhDescrip,ruhDate,ruhLocationID,rudTotal,rudProductID
ORDER BY
	ruhDate DESC, ruhId ASC


0/0
 Reply   Quote More 

Reply to All    
 

1–20  21–40  41–60  61–75

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats