Trying to calculate the range between different steps in my data-table and return the median for each calculation using this SQL code: This returns the following error message: [0A000][500310] Amazon Invalid operation: within group ORDER BY clauses for aggregate functions must be the same; java.lang.RuntimeEx…
Tag: sql
sql – select single ID for each group with the lowest value
Consider the following table: ID GroupId Rank 1 1 1 2 1 2 3 1 1 4 2 10 5 2 1 6 3 1 …
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: +—-+——+——…
select columns’ values based on another two values from another column
I have this data set and I need to extract multiple columns values based on on column value. To elaborate on it, I have a rental table, inventory table, customer table, and I want to relate customer …
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 – join three table with “where” clause
I want to write an SP that I will use in my c# program. I have three tables: Table1 (id pk, name, …), Table2 (id PK, name, …) and Table3((idT1,idT2) PK FK). So, Table3 models the n:n relationship …
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 …
how to use select into to insert many records
i have a stored procedure that will copy data from table A to table B and return id that is generated from table B to update table a record . this is sample data table A is : id—-Name—refId—…
How to update a third table with the result of a select inner join of another two tables
I have an access data base with three tables named DD, Export , and RPL I have the result of a inner join betweent EXPORT AND DD which is working fine Now with those results I want to update a third table RPL which is currently empty but has those fields to be populate for example RPL.[Hotel ID] should be
SQL Server – Use substring in where clause
I’m trying to come up with a query in which it’s going to filter based on a substring. The substring operation is working fine if I use it as a select statement, but not when I try to use it for …