I’m writing an Excel macro to pull in data from another Workbook. I don’t have any control over that workbook, which is a shame because then I could fix this issue at source, as it is i have to work …
Transform table to one-hot encoding for many rows
I have a SQL table of the following format: ID Cat 1 A 1 B 1 D 1 F 2 B 2 C 2 D 3 A 3 F Now, I want to create a table with one ID per row, and multiple Cat’s in a row. My …
Restore Backups automatically using SQL Server
The general context is that, I try to restore a list of backups automatically using the script below. I put all the backups in the same folder, after that I put the names of the backups in a table to …
SQL request with GROUP BY and SUM in Eloquent
I just want make a simple sql request in my laravel application. I’m not very comfortable with Eloquent aha. This is the SQL request I want to make with eloquent : select user_id, project_id, sum(…
Response from query couldn’t map to pojo class spring boot
Every response from query should be mapped to a poja class. I have written a native query @Query(value=”SELECT new QuestionJsonTotalAnswer(q.question) FROM mydb.question q”, nativeQuery=true) List&…
Returning all components multiple levels under a parent component
I have a hierarchical database out of which I would like to return all components in an asset with a specific common parent component. Components in table astComponents are linked to their parent …
Delete Result Rows from a Table in SQL
I have 2 tables named BM_Data1 & BM_Data1_May62019. Both Tables contains the same data as BM_Data1_May62019 is the copy of BM_Data1 table. But BM_Data1 has some extra rows, How can I delete those …
rails multiple has_many relationships between the same models
I’m trying to figure out the best way to model a many-to-one relationship in rails where there are multiple scopes to the relationship. An example would be a restaurant has-many photos. I want to be …
How do you select all rows when data occurs in one of the rows?
I have a table with data |FormID|Name| 1 A 1 B 2 A 2 C 3 B 3 C I am trying to query all rows where Name ‘A’ appears, …
How to show column names in a row
I want to write a SELECT statement to show the list of fields in the table. COLUMN column_1 column_2 column_3