Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 23rd, 2003, 08:08 AM
Authorized User
 
Join Date: Oct 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default join two counts field

I have two recordsets that I am counting the data from the same table with different search criteria. I would like to join Org, FinApp, RootCause in the one table. Could you help me how to do that?

Thanks...

Here is the my select statements that I am counting the data from database:

strListFinAppCounts = "SELECT strOrg as Org,count(nID) as FinApp from tblCycleCount where dDateApproved = 'n/a' and dDateRecount = 'n/a' and (dDateRejected = 'n/a' or dDateRootCaused <> 'n/a') group by strOrg"
set rsListFinAppcounts = Server.CreateObject("ADODB.Recordset")
rsListFinAppCounts.Open strListFinAppCounts, oConn1

strListRootCounts = "SELECT strOrg as Org,count(nID) as RootCause from tblCycleCount where dDateApproved = 'n/a' and dDateRejected <> 'n/a' and dDateRootCaused = 'n/a' group by strOrg"
set rsListRootCounts = Server.CreateObject("ADODB.Recordset")
rsListRootCounts.Open strListRootCounts, oConn1
 
Old October 23rd, 2003, 09:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'm not sure I understand what you are looking for. What do you mean by wanting to "join ... in the one table"? What does "join" mean in this context?

Remember that the COUNT function counts rows, and the WHERE clause selects which rows are being counted. Since your two queries are each counting the number of rows by selecting entirely different sets of rows, I don't think they can be "joined" together in any meaningful way into the same 'output' row(s)...

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old October 29th, 2003, 04:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I am not sure what I assume in this case is correct.

I think erin means to "sum up" those two count outputs by saying "join"

Is that so erin?


-Vijay G





Similar Threads
Thread Thread Starter Forum Replies Last Post
Join for two different counts on same view thenoseknows SQL Server 2000 0 January 21st, 2007 06:37 PM
Getting Counts [email protected] SQL Language 2 October 27th, 2004 04:01 PM
Oracle 8i inner join and left join problem puteri_84 Oracle 2 August 19th, 2004 07:14 AM
sql & join tables & find a field in multiple table trangd Beginning PHP 2 January 29th, 2004 07:18 PM
Get Counts harpua Classic ASP Databases 3 June 10th, 2003 12:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.