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.
| 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:Domain1Domain2Domain32) Average number of ServiceNames per AccountIDThanks,JaybeeSET NOCOUNT ON ;-- validSubscriptionsselect top 100 percenttblServicesTree.serviceID ,tblServicesTree.serviceName ,tblAccounts.accountID , tblAccounts.ntUserDomain ,tblAccounts.ntUserID ,tblAccounts.accountEnabled ,tblAccounts.accountFirstName ,tblAccounts.accountLastName ,tblAccounts.accountSubscriptionsEnabled ,tblAccounts.useHtmlOnEmails from dbo.fn_getValidSubscriptions() as vsinner join tblAccounts on tblAccounts.accountID = vs.accountIDinner join tblServicesTree on tblServicesTree.serviceID = vs.serviceIDwheretblAccounts.accountEnabled <> 0 and tblAccounts.accountSubscriptionsEnabled <> 0SAMPLE RESULT SET:serviceID, serviceName, accountID, ntUserDomain, ntUserID, accountEnabled, accountFirstName, 167........Multi SIM.......50194........20-uk.............puckern........1.................Natasha Pucker 158.........HARMS..........36394.........20-UK............SuUTERG.........1................Gordon Suuter 1161........Prknet..........31547.........20-UK............EVAND5.........1.................Dennis Evan 184.........SURFS/.........34388.........20-UK............MILbergK........1.................Kevin Milberg 1 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
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. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|
|
|