Skip to content
Advertisement

Tag: database

How to solve “SELECT list is not in GROUP BY clause and contains nonaggregated column” without adding the column into “group by”?

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

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

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

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

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

Advertisement