Iterate through Table Rows in sql
-
Is it possible to iterate through a table or a temporary, because i have to add a temporary column and insert different values for each row according to condition to return a comma separated value. I show a rough sketch what i want to do. Select SAP.LoginName,var="--Some Very Long Query according to a criteria within the rows of a table like where Test.Folder_ID=CM.Folder_ID--" From dbo.sysCommunicatorMessages CM Inner Join dbo.sysAppLogins SAP On CM.MESSAGEFROM = SAP.LOGIN_ID where "--Some Criteria--" and CM.Folder_ID<>-2 I have used functions to solve the problem but they are currently not acceptable.
Bye
-
Is it possible to iterate through a table or a temporary, because i have to add a temporary column and insert different values for each row according to condition to return a comma separated value. I show a rough sketch what i want to do. Select SAP.LoginName,var="--Some Very Long Query according to a criteria within the rows of a table like where Test.Folder_ID=CM.Folder_ID--" From dbo.sysCommunicatorMessages CM Inner Join dbo.sysAppLogins SAP On CM.MESSAGEFROM = SAP.LOGIN_ID where "--Some Criteria--" and CM.Folder_ID<>-2 I have used functions to solve the problem but they are currently not acceptable.
Bye