navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Distinct count?? within a query

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Distinct count?? within a query
Page: [1]
 
CraigBFG

 

Posts: 211
Joined: 7/25/2003
From: UK
Status: offline

 
Distinct count?? within a query - 1/16/2004 9:10:34   
I have this query which gives me a list of categories and various counts against them. What I'd like to do is include an "address count", as the same address may be responsible for multiple calls. At the moment, when I do a count, the number of properties=the number of calls which may not be true.

SELECT tblDefCatType.DefCatType, tblDefCatType.DefCat, Count(tblDefect.DefID) AS Defects, tblDefCatType.DCTId, tblUsers.UId, Sum(Right([Result]<>'valid',1)) AS NV, Sum(Right([Status]='closed',1)) AS Closed, Count(tblDefect.AddID) AS CountOfAddID
FROM tblUsers RIGHT JOIN (tblDefStd INNER JOIN (tblDefCatType LEFT JOIN (tblResult RIGHT JOIN tblDefect ON tblResult.ResultId = tblDefect.ResultId) ON tblDefCatType.DCTId = tblDefect.DCTId) ON tblDefStd.DefStdId = tblDefCatType.DefStdId) ON tblUsers.UId = tblDefect.UId
GROUP BY tblDefCatType.DefCatType, tblDefCatType.DefCat, tblDefCatType.DCTId, tblUsers.UId
HAVING (((Count(tblDefect.DefID))>0) AND ((tblUsers.UId)<>17))
ORDER BY tblDefCatType.DefCat, Count(tblDefect.DefID) DESC;

Eg
Heating Not Working - Total Calls (5) - Total Closed (4) - Total NV (1) - Total Properties (2)
Essentially showing me that all the 5 calls came from 2 properties.

Please help
Thanks
Craig
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Distinct count?? within a query
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts