Skip to content

Tag: sql

Sum rows with no field to group by

I’m using SQL server 2012 and I’m trying to sum rows of a table. Problem is I don’t have a column to group by. Is this possible…? How would you raise the query? Original table: +—-+——+——…

Sorting Values into Different Columns

I have a table like this: OrderID OrderStatus DateCreated ——————————————– 13 3 2018-10-25 09:33:14.937 13 4 2018-10-25 09:33:19.010 …

SQL SELECT composite primary key

I have 2 tables User1 and Relationship and it’s some kind of user-friends relationship. I need to find all the friends of a user. For example: I have a user with ID=3 and I need to find all the users …