Trying to use the SQL string_split function in a dynamic query but I continue to receive the following error. Invalid column name ‘Invoice Description’. Argument data type void type is invalid for argument 1 of string_split function. I can not figure out the issue. Any help is greatly appreciated.…
Tag: sql
SQL query with multiple OR condition inside AND returns null or empty
I’m trying to get those members who are going to match my filter criteria, but I am passing multiple OR condition inside the round brackets, and every condition which is inside the round brackets is, AND with another round bracket; however, the query does not work, and it returns an empty table, but whe…
SELECT INTO vs WITH AS: Who is faster in the temp table approach?
I have a little experience with these two structures. Is there a performance improvement using one or another to use temp tables? I know that SELECT INTO creates a table that persists after the query and is removed after some time. There is some problems when using the same query after a few seconds (SQL Erro…
How to combine multiple rows (one column) into One row
I am using SQL server 2017 and I have a scenario where I want to combine multiple rows of data into one row. Please see the below screenshot and let me know if that is possible. Thank you. Apologies if anything is missing. Please let me know the query on how to achieve this Answer SQL Server has supported str…
Postgresql constraint violated at restore
I have a problem with a constraint that is being violated by some rows when restoring my DB, but has never been violated at usage. I have 3 tables : some_table here is another table, which I think is not relevant for this problem. Now what I want is to have a unicity constraint between as.id and bs.some_id th…
How to create a column in SQL containing using the AVG() function?
I have a table with one column and 46 rows and I want to create another column that contains the average of the first column in all 46 rows e.g. This is the table: I want to add another column that contains for each row (46 rows) the value of AVG(column1) How do can it be done? Answer You wouldn’t
Create subqueries for each value in a Column
I’m looking to create a SQL query that answers the following question: “Which was the most common destination airport in each month?” The table is structured such that it has Month and Destination_Airport columns (amongst other things), and I’m hoping for the query result to look like …
Remove duplicate rows from a big table
I’ve got data from third party and imported to SQL server. The table has 255,072,636 records and 61,714,772 are unique among these records. The table has neither specific order nor any index. The table has 4 columns: Field1(float), Field2(varchar(255), Field3(varchar(255), Field4(varchar(255). I want to…
Order of Procedure for Select statement with Where Clause and other operators
This is the table I’m working off: From this order of procedure that was provided in class: Parentheses */ +- = <= >= < > IS Between NOT AND OR I have to work out how many rows of the following statement with show up: Is this statement read in this order: QtyA+QtyB QtyA+QtyB < 5 gender = …
Unexpected results with consecutive + and – [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I have the following queries : The result is : How is this output explained…