Skip to content

Tag: mysql

Calculating daily volumes from total volume

I have the following data: ID Date Total A 2021-09-03 0 A 2021-09-04 12 A 2021-09-05 37 A 2021-09-06 40 B 2021-08-03 20 B 2021-08-04 43 B 2021-08-05 75 And from this data, I would like to get the following table: ID Date Total Daily A 2021-09-03 0 0 A 2021-09-04 12 12 A 2021-09-05 37 25 A 2021-09-06 40

How can I use IF and CONCAT within SELECT

I have this Adjacency List Model table Table: Output: So I have the following query that duplicates a Site 1 e.g. and its children. In this case, the children are Paper with parent_id = 2 and ms1 with parent_id = 3 Output: As you can see Site 1 and its children got duplicated with a new unique id. However for

Subqueries in MySQL

My first post here and I am desperate. Need this to complete the last 2 questions of my assignment. This is the code I wrote and it is outputting almost what I need. The problem in the assignment wants to display Employees or Guests that are from Winnipeg or London. My code gives me all the cities for each em…