Skip to content

Tag: sql

SQL Find column with multiple possible values

I have two tables: TABLE 1 TABLE 2 I need the rows from Table 1 where i can have ALL values from table 2. The values from table 2 are dynamic, so i need to create a procedure to search for these possible values. My output should be in that example: Answer You can do this by doing a join

Inserting rows based on conditions

Table Name: CaseHistory I’m currently working with a dataset that aims to offer insights on customer support cases on a weekly basis. In the example above, you can see the progression of case 123376 from Week 1 till Week 5, amongst other cases. What I would like to be able to do is insert a row for a ca…

Average price based on dates

I am trying to calculate a weekly average, and add it as a new column along side what I already have. I have added week starting dates and week ending dates as I thought that would be useful (and how I found do it in a more familiar MS Excel environment). This code returns a table with 4 columns. I

Date compare and difference

I have “Employee” table with employees’ “StartDate”. I want to get a list of all employees who are reaching their work anniversary next month. So far I have reached up to this point: …but this doesn’t seem to be working. Answer I want to get a list of all employees wh…