I am trying to fetch data from the database in this way: I want all the templates and those templates have an array of categories in it so the methode I am currently using currently I am doing this but the object doesn’t seem to alter. Answer You are not waiting for the promises to resolve. You should do: instead
Tag: sql
Grouped aggregate counts for each date in a series of dates
I am trying to get grouped task counts by state over a series of dates using the following tables: There isn’t a consistent daily “state” record for each task because task_logs only has entries for when a task changes state. This means I have to get the last “state change” log for each task prior to a specified date. I’ve
I want to query the row values as Column in SQL
I have a query to result in the below data from DB But actually, I want to get the data as Is there any way we can do this the SSRS? How can I do this? really stuck Answer You can do this easily in SSRS without changing your dataset. Add a Matrix control to your report Drag the Assignee
How to add a vector to a table in backend using dbplyr (R)
I created a table from a data source using tbl(). I need to add a column including 1:nrow() to my dataset and tried different methods but I didn’t succeed. My code is as below: It doesn’t add column ID to my dataset and only adds column step. Using as.data.frame(), it works but so slow. Do you have any ideas? thanks
Replace all email addresses after ‘@’ in PostgresSQL
I have a list of emails. I want to change all of them to test emails for my test system e.g. sam@gmail.com to sam@test.com. I don’t want to use actual emails as those emails are valid and it will be bad for users to receive such email. Is it possible to change all emails at once in a single query?
Save the output of a procedure in snowflake in a variable
I have following procedure: Now I want to do two things: First I would like to save the output of the procedure in the variable todays_amount So I tried this: But this does not work. And second: Instead of where TARGET_KEY = ’20’ i would like to do where TARGET_KEY = targetkey_variable But this does not work. Answer It appears
How do I insert multiple rows with many to many relations into ‘Table1’ from ‘Table1’?
I’m trying to copy an existing ship, with all of its contents of its child tables (for lack of a better term) and their relations. So far I’ve got most of the copying down except for the ship’s tables that have a many to many relation. An example of my current situation is as follows: I have two individual tables
If case within string in JavaScript with variable either inside quotation marks or NULL?
This question is difficult to title but easy to show. I would like to add multiple sets of values to an SQL insert such as this happens in a loop and thus the separation of insert string and values string. Now, what I want to happen is that if event.url contains a url it should insert the url as ‘https://www.example.com’
SQL FOREIGN KEY ERROR (errno: 150 “Foreign key constraint is incorrectly formed”)
Hi I have this three very simple tables but I can’t fix it to get the right format of foreign key. CREATE TABLE company( company_name varchar(30) UNIQUE NOT NULL, bid INT(15) NOT NULL UNIQUE, cid INT(15) NOT NULL UNIQUE, FOREIGN KEY (bid) REFERENCES branch(branch_id), FOREIGN KEY (cid) REFERENCES contact(contact_id) ); CREATE TABLE branch( branch_id INT(15) NOT NULL AUTO_INCREMENT UNIQUE, branch_type
In SQL, how do I filter a parent with its child records if either satisfies a condition
I have the following table as example. I want to retrieve only the records where the ScheduleDate is smaller than 2022-01-03 (Jan 3, 2022) for either the parent and child records but I want the whole family only (parents and children together). With this set of records, the results should return the records 1 to 9 only. ScheduleId 12 does