Skip to content
Advertisement

SQL Server => How to use “case when” on multiple column to show a formula result based on a condition in the same line

I’m trying to provide an overall result of a formula ([CALCULATION]) and then in two extra columns ([NO_TENURE] & [TENURE]) the same calculation but using “CASE WHEN” to filter the information based on another column called [TENURE], everything in one single line like this: Right now is being shown this way: This is the code I’m using: I really appreciate

Fill Null Values with Last Previous Value and add 1 as a continuous integer for every value going forward – Big Query

I have these two columns in Big Query: budget_id and activity: budget_id activity region execution window 000507_Corporate 507 Corporate 2022 000508_AMERICAS 508 AMERICAS 2022Q2 NULL NULL c b NULL NULL c b The budget_id comes from a Google Sheet which is manually inputted by a stakeholder. I’m trying to change this that going forward, I can automate this myself. Everything

Replace OUTER APPLY

I want to replace some OUTER APPLYs in my SQL because they seem to be a little bit slow and eating resources () on a poor VPS. I have no idea what to use instead? LEFT OUTER JOIN (??) Here’s my code The query processor ran out of internal resources and could not produce a query plan. This is a

I can’t get the correct output when I use / ORDER BY from my SQL example?

I was playing around SQL sample that I wrote and I’m quite surprised that I couldn’t get the correct output when I use less than, greater than or ORDER BY. for example, select player_name, jersey_number from Players order by ‘jersey_number’ desc; it should give players name and jersey number sort descending order from their jersey number. However, this is what

Advertisement