Can anyone please advise: I have an existing nodejs server running on azure, running node 10.14 on Linux. The project code is on github and when I push changes they are automatically pushed to azure. …
MySQL Attendance IN & OUT columns with correct times
I have a database for attendance, it works fine as long as the person does not work over 2 dates. I want to utilize IN and OUT system for records but I do not know how to do the final step, and what I …
Remove items 30 minutes after their duration
In a table in my database, I have a date and time column (datetime) that stores the time when the event will occur. How can I delete that event 30 minutes after it happened?
PostgreSQL, add row to table when a row is created in another table
I am trying to create a trigger function, to create a new row, in a table, when a value is modified or created in another table. But the problem is that I need to insert in the other table, the …
Determining Where Date Ranks | BigQuery
I have purchase data that I’m trying to analyze. I’m attempting to find the 2nd and 3rd purchases (and potentially 4, 5, etc.) for each user. The data I have currently looks like this: The first order column is looking at what was in the first basket that the customer purchased. Is there a way I c…
Sum data based on columns
Table 1 has several columns with distinct values. What I want is this information combined and condensed to the different column levels, so that the sale and value amounts are sum’d based on the product and type in the year and months instead of each distinct line being displayed as a separate value. For exam…
mySQL foreach row run an update
Progress table has progressId, lessonId and uniqueId TestResults table has progressId TestResults table now has lessonId and uniqueId This SQL statement foreach progrssId in TestResults will get lessonId and uniqueId from Progress: Now I want to update lessonId and uniqueId in TestResults table foreach associ…
Create table from a table in SQL Server
Below is the query I tried to execute in SQL Server: I get this error: Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ‘(‘ I did some research on google to understand and isolate the error, but, failed to do so. Could anyone please help me understand the error. Thank you Answer SQL-Server…
SQL Server Concatenate three different columns into a Comma-Separated without repeated values
The next table is a simplification of my problem in SQL Server: I want to get a group with the columns concatenated by comma without repeated values. I tried to use STRING_AGG() but it returns: This is the query I have done: I would like the next result: Thank you! Answer Without using window functions. The u…
Find date range for every row. LEAD/LAG but with different types/actions
I have a table with following data: There are two actions possible. ‘Remove’ and ‘Install’. How can I find Place for Code A for given date? For example for 2015 it will be Place 1. For 2020 it will be Place 2. For 2025 it will be Place 3. I think the first and the most difficult step i…