Skip to content
Advertisement

Tag: sql-server

MS SQL query to list count by status

I want to achieved the result below. I want to list all records having a status of “For Approval” together with this condition: For example for Username ‘Leo’ Then sum all the status having “For Approval” which is the checker is ‘Leo’ with the condition above Answer I think this is what you are after; if its not i have

T-SQL Conditional WHERE Clause

Found a couple of similar questions here on this, but couldn’t figure out how to apply to my scenario. My function has a parameter called @IncludeBelow. Values are 0 or 1 (BIT). I have this query: If @IncludeBelow is 0, i need the query to be this: If @IncludeBelow is 1, that last line needs to be excluded. (i.e don’t

Advertisement