table: id action project_id created_on last_updated_on 1 Update 123 2021.1.1 2021.5.3 2 creation 123 2021.1.4 2021.5.2 3 Update 123 2021.1.3 2021.5.1 4 Update 456 2021.2.1 2021.6.3 5 Update 456 2021.2.2 2021.6.2 6 creation 456 2021.2.3 2021.6.1 I would like to get a map of project and its most recently created Update action’s last_updated_on. My statement is But I got the
Tag: database
Using column from another table in trigger
I need to use a column from another table when i use trigger before insert but i get an error Unknown table in field list Here is an example code: the column from another table is “printing_time_hr” from table “slicer” Please help, what to do, how to use the column from another table Answer This works for me:
Find the number of employees working under a manager
I have three tables called branch,employee and manager structured like this I want to view the id of each manager and the count of the employees he has under his supervision like this I have made this so far that shows which branch each manager works on but i don’t know how to proceed with the counting. The solution i
How to combine information from a main table and a log table in SQL Server
I currently have 2 tables in my database that i need to combine information from. One of them is a log table, that registers the status change of all products in the system. Structure example: ChangeDate Product LastStatus NewStatus 2021-10-01 A New Aging 2021-11-02 A Aging Ressuply 2021-11-25 A Ressuply OFF 2021-08-03 B New Aging 2021-09-04 B New Aging 2021-10-13
In access/SQL how do I make only the null values in a column equal to value in another column?
I want to make only the blank cells in ATTRIB_VALUE equal to the values in ATTRIB_VALUE_NUM_9. Answer Something like this: I’m not sure what your table name is based on your post, but I think that’ll get you what you need.
Filter table to leave out specific rows
I have the table and now I want to list every ProjectName where there is no specified Leader like this: Right now I only know how to filter all ProjectNames with Leaders, but not the way to filter them the other way! Any help is appreciated 🙂 Answer One way to do it is with aggregation and the condition in
How to compare two row in same table and return the data in response using stored procedure
I have to compare between two rows using two Id’s in the same table, and I want to get the columns and their values that are not matching in the stored procedure and I need to return it in JSON format. Output: I don’t have expertise in it however I tried the below SQL code but I need this in
Find duplicate data in last 1 hour
I am looking for a SQL script to find the data which has more than 2 entries in last 1 hour. I have a table having user_id & event_time. I want a way to find out if the user_id has more than 1 entries in last 1 hour. I have tried below till now: Create temp table to put all
“Buy Items” with SQL Transaction in EF Core, if user send many requests, items are bought even if they can’t afford it
I’m trying to make a game where the user can buy items with ingame coins. The coins and the items are stored in a SQL database, and user should (obviously) only be able to buy items that they can afford. The Problem with this code is that if the user spams many requests at the same time, he gets more
Insert selected columns from one table to another SQL
I have two separate databases in the same host (localhost:3306). I have one table from the first database and a second from the other database. Here is 2 screenshots to become more clear I need to match: Is there any automatic way with a software? Need I to write some specific query to copy these 4 columns from one table