I have a json object like this: {“1”: {“penalty_percent”: 3, “free_day”: 5, “free_hours”: 24}, “2”: {“penalty_percent”: 2, “free_day”: 5, “free_hours”: 12}, “3”: {“penalty_percent”: 2, ̶…
Tag: mysql
How to change query result into another value in MYSQL?
For example, I have a column named ‘form_type’ consisted of int (1-4) id_event|form_type ——–|———- 001 |1 001 |3 001 |4 002 |2 002 |1 When i query SELECT form_type …
SQL subquery , using WHERE & ‘IN’ to filter for specific rows
please use here and copy the code in below to add context to my questions. As you see, I have a table and within it certain Father’s have the same name, I want to choose the father that has the most dogs for my final list. You can see the entire table in Query #1 , my desired result in
make multi-condition for query in querysolution this query in mysql [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question But, i’d like to take values of left and right border from query I try to explain make…
SQL statement to update rows in a table, insert into/update same table
I have a seemingly pretty simple situation here, but one which I have never dealt with. I have researched the issue and have found situations pretty similar, but not close enough to run on a production db. I have 1 table with 2 columns. I want to find all entries that share the same values in column 1, and up…
Find between which 2 numbers a value lies in MySQL
I have a variable @k=35. and a table xrf having contents as show below. How to I get the values in between which @k exist in table xrf. output is 30 and 40. Answer Using conditional aggregation
How to combine two queries with case statement
How to combine two queries with case statement query1 query2 Expected output: Answer With conditional aggregation: The conditions where by_user = ‘3’ or where by_user <> ‘3’ are checked with a CASE expression, so they are removed from the WHERE clause.
How to group by multiple rows and column
For each user 3 codes are there(10,20,30) if all codes(10,20,30) are true then it has to JOINED if any codes(10,20,30) are False then it has to NEGLECTED WE have to check max(date) Table is below: Output user2 and user3 is JOINED, user1 is NEGLECTED Answer I assume that the column bool is of data type BOOL, s…
How to modify result of select statement based on values?
I am not MySQL guy just learning by doing things, I have database that stores value 0 or 1, now in grafana I want to display online if value yield from select statement is 1 and offline if value of online in select statement is 0. So far this is what I wrote But select statement through error. Answer You̵…
How to have exact decimal values without rounding in MySQL
I have this SQL script below: What I expect like result is: 72.39. I don’t want to round the number. if I use the select round(72.396, 2) the result I get is: 72,40 How can I have what I expect without rounding using Mysql? Answer You need to use the truncate function instead of round: To answer the que…