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 do I get the lates tm.detail_notes ( tm.detail_notes for max(tm.timeslip_date))?
I have a query that return some record, but I need to get whatever the latest tm.detail_notes on max(tm.timeslip_date). Right now I am getting an error. (I have multiple record dates on the table and each day have note) Query Error The text, next, and image data types cannot be compared or sorted, except when…
How can I add a row to my SQL results between each “category” change in the data?
I use SQL Server 2019 to produce a long list of shipping options. This list is produced by a simple query on a table containing the list items, and displayed on a handheld terminal. Users find it cumbersome and time-consuming to navigate the list to find the correct option, and must do so several times per da…
Getting NULL after combining strings between date functions
Given a date column with a value 2020-05-01, I want to return 2020-Q2. The QUARTER() function is not available due to the Hive version we are using. I can get the quarter number with: (INT((MONTH(yyyy_mm_dd)-1)/3)+1). When I try to combine this with the YEAR() function and strings, I get null: How can I prope…
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 update column with row number in group by result in MySQL
Sample Data: Desire Data: how to write a sql to update the room seat number to serial num in MySQL 5.7? the room’s seat is from 2-20. Answer One option uses the update/join syntax. In MySQL 5.7, where window functions are not available, you can emulate row_number() with a correlated subquery (which is s…
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…
SQL query to run LDAP query to return AD listing of active users and then groups they are assigned to that start with GRP-XP%
I am trying to write a sql statement to control a report header selection of multiple database by user groups a user is assigned to. This is to limit the database selection security when running an SSRS report so that they can’ only select their branch or group of branches they have access to. So far I …