Skip to content

SQL left join is not including all records from left table

I have a requirement to get monthly total hours worked on different tasks for each employee. For that purpose I am writing a stored procedure. But left join is not populating all record from employee table. I know somehow the where condition is filtering out the null values but I really don’t know how t…

Grouping rows based on a date field in SQL Server

I have the following table exams.sql with exam scores in SQL Server. It saves the student’s ID, their score, and the test date. The problem begins when a student takes the exam two (or more) times. I need the complete list of students with their actual qualification: in case they have been evaluated mor…

how to get multiple columns from subquery inseide sql statement mysql

actually, I found many solutions for my issue but I didn’t understand how to apply to my issue! my issue is I have the following SQL statement: what I need is to replace the following part in one part: to get the all columns in one subquery with the same conditions? Answer I don’t know your data s…

Adding rows to a table respecting the key columns structure

I have a very large table, which follows these structure (I past it here simplified): Product Line Name Quantity Unit Cost Pepe 10000 Lucia 4 UD 8 Pepe 20000 Santiago 7 UD 5.5 Pepe 30000 Mariangeles 10 KG 6 Antonio 10000 Naiara 4 KG 8 Antonio 20000 Toni 7 KG 3 Vanesa 10000 Lucia 4 UD 8 Vanesa 20000 Santiago

Finding Cumulative progress with SQL

I have a SQL table as below : I need to calculate the cumulative progress. for example S1000 have three f1 score. the progress calculation formula is (95 – 87) + (87 – 80) for S2000 the calculation would be (75 -17) + (17 -57) How to achieve this using SQL Answer It looks like your progress score …