Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
10-19-2009, 05:59 PM #1
- Join Date
- Aug 2009
- Thanked 0 Times in 0 Posts
How can I loop through a select Statement
Anyone know how I can loop through the following select statement? I get multiple rows for a user if they have a value in all the following fields [CDM Master Access], [KnowledgeMaster Access], [Knowledge Source Access]. I'm trying to get it all to just show on one row .
Select a.UserID ,b.Username ,b.FirstName ,b.LastName ,a.HospID ,d.HospName -- ,a.productareaid ,[CDM Master Access]= CASE WHEN c.ProductAreaName= 'BPI.Net' THEN 'CDM Master' END ,[KnowledgeMaster Access]= CASE WHEN c.ProductAreaName= 'BPI KnowledgeMaster' THEN 'KnowledgeMaster' END ,[KnowledgeSource Access]= CASE WHEN c.ProductAreaName= 'Knowledge Product' THEN 'Knowledge Source' END ,max(logtime) as Last_Login ,count(*) as Num_Of_Sessions_to_CurrDate