JaybeeinTekTips
Technical User
Hi all,
I need a final tweak I need for this code, what I need now is for firstnames, surnames, servicenames and some other generic data to be returned (again, this data is ALL contained within the function and tables - I checked!) and grouped by distinct accountID. I'm sure it'll involve a Group by statement, but I'm not sure where it goes. I imagine my code will look similar to this;
Select top 100 percent
tblServicesTree.serviceID ,
tblServicesTree.serviceName ,
tblAccounts.accountID ,
tblAccounts.ntUserDomain ,
tblAccounts.ntUserID ,
tblAccounts.accountEnabled ,
tblAccounts.accountFirstName ,
tblAccounts.accountLastName ,
tblAccounts.accountSubscriptionsEnabled
FROM dbo.fn_getValidSubscriptions() as vs
JOIN tblAccounts on tblAccounts.accountID = vs.accountID
JOIN tblServicesTree on tblServicesTree.serviceID = vs.serviceID
WHERE tblAccounts.accountEnabled <> 0 AND tblAccounts.accountSubscriptionsEnabled <> 0
AND tblAccounts.ntUserID NOT IN ('Domain1','Domain2','Domain3')
CURRENT 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
I need a final tweak I need for this code, what I need now is for firstnames, surnames, servicenames and some other generic data to be returned (again, this data is ALL contained within the function and tables - I checked!) and grouped by distinct accountID. I'm sure it'll involve a Group by statement, but I'm not sure where it goes. I imagine my code will look similar to this;
Select top 100 percent
tblServicesTree.serviceID ,
tblServicesTree.serviceName ,
tblAccounts.accountID ,
tblAccounts.ntUserDomain ,
tblAccounts.ntUserID ,
tblAccounts.accountEnabled ,
tblAccounts.accountFirstName ,
tblAccounts.accountLastName ,
tblAccounts.accountSubscriptionsEnabled
FROM dbo.fn_getValidSubscriptions() as vs
JOIN tblAccounts on tblAccounts.accountID = vs.accountID
JOIN tblServicesTree on tblServicesTree.serviceID = vs.serviceID
WHERE tblAccounts.accountEnabled <> 0 AND tblAccounts.accountSubscriptionsEnabled <> 0
AND tblAccounts.ntUserID NOT IN ('Domain1','Domain2','Domain3')
CURRENT 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