Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Need to alter some code

Author  Topic 

jaybee
Yak Posting Veteran

72 Posts

Posted - 2007-07-11 : 09:47:38
Below is some rough code (some of it unnecessary) and an anonymised sample of its result set (how do I get the data to appear in grid format online??). I need to alter the code to return the following:

1) Total number of AccountId's where Ntuser ID is NOT in:

Domain1
Domain2
Domain3

2) Average number of ServiceNames per AccountID

Thanks,

Jaybee

SET NOCOUNT ON ;
-- validSubscriptions
select top 100 percent
tblServicesTree.serviceID ,
tblServicesTree.serviceName ,
tblAccounts.accountID ,
tblAccounts.ntUserDomain ,
tblAccounts.ntUserID ,
tblAccounts.accountEnabled ,
tblAccounts.accountFirstName ,
tblAccounts.accountLastName ,
tblAccounts.accountSubscriptionsEnabled ,
tblAccounts.useHtmlOnEmails

from
dbo.fn_getValidSubscriptions() as vs
inner join tblAccounts on tblAccounts.accountID = vs.accountID
inner join tblServicesTree on tblServicesTree.serviceID = vs.serviceID

where
tblAccounts.accountEnabled <> 0 and tblAccounts.accountSubscriptionsEnabled <> 0

SAMPLE RESULT SET:
serviceID, serviceName, accountID, ntUserDomain, ntUserID, accountEnabled, accountFirstName,

167........Multi SIM.......50194........20-uk.............puckern........1.................Natasha Pucker 1
58.........HARMS..........36394.........20-UK............SuUTERG.........1................Gordon Suuter 1
161........Prknet..........31547.........20-UK............EVAND5.........1.................Dennis Evan 1
84.........SURFS/.........34388.........20-UK............MILbergK........1.................Kevin Milberg 1

X002548
Not Just a Number

15586 Posts

Posted - 2007-07-11 : 10:38:36
I'm not sure what you're asking...use .NET?

Do you need some help with SQL?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

jaybee
Yak Posting Veteran

72 Posts

Posted - 2007-07-11 : 10:40:41
quote:
Originally posted by X002548

I'm not sure what you're asking...use .NET?

Do you need some help with SQL?



Yeah....that'd be nice.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-07-11 : 11:22:07
OK, so what's the question?

Read the hint link in my sig, and post what it asks for


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -