Skip to content

Mark values with diffreent tag in sql

I have one endpoint that is 7. I would like to few numbers 40,35,30,26,22,18,12 mark as completed.(This is an example. The value may be different) and few numbers 13,17,21,27,32,38,43 mark as pending. (This is an example. The value may be different) Can we achieve by SQL statement? for number details, please …

Multiplying 2 column values in Dynamic SQL

This is giving the error message: Conversion failed when converting the varchar value ‘27.72081’ to data type int. Answer You’re casting numeric values to VARCHAR inside your dynamic statement. Remove the CASTs and it should be good. Your resulting statement should read something like this w…

How to convert time given as string into integer mins

What I’m trying to ask is that I’ve a table Duration. It has only one field elapsed and it is VARCHAR. The table is this: I want this table: total should be integer or number. I’ve to perform some arithmetic on it later. Here’s what I tried: Please help me. Note: I need MYSQL query not…

How do I query every person that does not know anyone that takes classes?

I’m struggling with the following SQL problem: I must query all persons that do not know anyone who takes classes, using the following tables: After a long time trying different queries, the following query is the closest I got to the desired result: I seem to get more results back than is necessary for…

How to calculate running sum for each group in MySQL

Straightforward summation I can do with sum() function. But I’ve a different situation here. I’ve a table Student with only 2 fields. For instance just assume that there is only 1 student in the entire class: And I have his scores for the days when exams were taken with one more column in the runt…