still learning about SSIS I have an excel source in SSIS, I need to create a case statement based on one of the columns [Teacher] but as a derived column (as it does not work in the SQL statement) the …
SQL Select from many-to-one
I have two tables containing a one-to-many relationship. How should I select the “one” side given information for the “many” side? I’m using SQLite. Let’s say our first table, T1, is about cars and the second table, T2, is about the imperfections in each car. Let’s sa…
C#: Dapper with JsonConvert.SerializeObject() not working properly
I’m new to Newtonsoft.Json and Dapper. I am executing an SQL query, and using the query’s result I’m converting it to a JSON string to try to make it look like this: { “Orders” : [{“…
How to make a MySQL query that checks if the column is the beginning of another string
I have a table Folders that has a column called path. I want to get all folders whose path that could be the beginning for “folder1/folder2/folder3/folder4/”. Acceptable folders would be …
How to use SQL math functions with multiple joins
in SQL Server I have two fact tables. FactA I will use COUNT(DISTINCT) and need to use two joins to get the needed GROUP BY and WHERE data from DimB. FactB uses SUM and needs only one join to DimB. …
Joining Temp Tables Using Indexes
I’m just beginning to learn about INDEX and I’ve heard it could speed up results but my testing is having the opposite effect. Some points about the data: My company uses a SQL Server but I don’t know much else beyond that I’m just an employee and don’t have any sort of admin acc…
SQL Select List mulitple values with case then
I have a variable and based on the variable I want to exclude the value from the select command. It works fine if I want to exclude 1 string, but if it’s not working if I’m excluding multiple string …
How find row by exact much of joined rows with SQL?
I have two tables I want to find specific row from parent table with name A which have exact two related rows in child table with names a and b. In example table is only one row is suitable (with id = 1). Row with id = 2 is not suitable because name of parent is B. Row with id
SQL Server – Ordering Combined Number Strings Prior To Column Insert
I have 2 string columns (thousands of rows) with ordered numbers in each string (there can be zero to ten numbers in each string). Example: The end result is to combine these 2 columns, sort the numbers in ascending order and then put each number into individual columns (smallest, 2nd smallest etc). e.g. Cols…
Nested aggregate function in PostgreSQL
I am trying to return every author_id, author_name, and AVG(total) per author for every article_group. I am trying to lump the author_id, author_name, and AVG(total) into arrays. I understand that …