Skip to content

Tag: sql-server

Arranging data by year and proportion

I have one table with the following format: Note 1: [End_Date = NULL] means that participation has not ended. [Proportion = NULL] means that participation is 0. Output: I want to have the proportion of each sub_entity for every active year. Note 2: One Sub_Entity can be a proportion of different Entities. The…

Group by question in SQL Server, migration from MySQL

Failed finding a solution to my problem, would love your help. ~~ Post has been edited to have only one question ~~- Group by one query while selecting multiple columns. In MySQL you can simply group by whatever you want, and it will still select all of them, so if for example I wanted to select the newest 10…

Need to Update based on ID and Date

I have the following SQL statement, which I think should update 1 field, using some pretty simple standard deviation logic, and based on ID and Date. I think the ID and Date has to be included to get …