The need to get some data from my SQL table, the data I need to get returned depends on the follow condition:
1) Return all data from table where commCommited column = 'Yes' unless commCommited column = 'No' and userCreatedID = @userID then return this data as well.
@userID is the uniqueID value of the user within the userTbl
e.g. Using image of table provided
If @userID = 2 then this will return all data EXCEPT rows 34 and 40 because commCommited = 'No' and userCreatedID = 3 (which is NOT the value of @userID)
If @userID = 3 then this will return all data INCLUDING rows 34 and 40 because commCommited = 'No' and userCreatedID = 3 (which IS the value of @userID)
Is there a way that I can do this within SQL??
Thanks for all your help guys
Simon
1) Return all data from table where commCommited column = 'Yes' unless commCommited column = 'No' and userCreatedID = @userID then return this data as well.
@userID is the uniqueID value of the user within the userTbl
e.g. Using image of table provided
If @userID = 2 then this will return all data EXCEPT rows 34 and 40 because commCommited = 'No' and userCreatedID = 3 (which is NOT the value of @userID)
If @userID = 3 then this will return all data INCLUDING rows 34 and 40 because commCommited = 'No' and userCreatedID = 3 (which IS the value of @userID)
Is there a way that I can do this within SQL??
Thanks for all your help guys
Simon