Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 1 y…
Tag: mysql
How to carrying over values for missing dates in time series using last value windows analytical functions in mysql
How to carrying over values for missing dates postcode/indicator_category to create full monthly time series. Im trying to use last_value to carry over values but not able to make it. Is my approach correct? Any help would by highly appreciated. Example given a table: INSERT INTO value to indicator_data table…
How to store number in shortest possible size?
I will be adding comments into my website and I want to have a tree structure so each comment can have a parent. This creates a problem when retrieving comments because each comment would have to be traversed for children and this is unacceptable when it comes to database storage. There are various solutions …
Sql function find date difference between two consecutive rows per group
I am working on clinical data to find total sessions for patients by finding date difference. I can achieve this using Python but power bi does not support that script. So I needed help to do this in SQL. I am basic level user of SQL so have no idea how to start for this. Below is raw data PatientID
SQL to generate %, n and N from the datatable
I seek your help in generating a summary query result as %, n (numerator), and N (Denominator) out of a variable in the dataset for each underlying category: e.g: data sr.no. is_healthy 1 yes 2 no 3 yes 4 no 5 yes 6 yes 7 no 8 yes 9 no 10 yes I expect the following as a summary result
MySQL or MariaDB spread Date range in single row into multiple series of rows
Example tables are below, and example rows below, What I want to get is convert table above to below so that I can join using each date in range. Is there any way to extend date range in single row to series of Date row? Answer MariaDB 10.2+ or MySQL 8+ needed.
SQL query to filter columns
I have a question regarding the SQL query. I have this table shown below Region Rep Item Quebec Jones Pencil Ontario Kivell Binder Ontario Jardine Pencil Ontario Gill Pen Alberta Sorvino Pencil Quebec Jones Binder Ontario Andrews Pencil Ontario Jardine Pencil Alberta Thompson Pencil Quebec Jones Binder Ontari…
MYSQL Query Age Calculation
This is my MySQL Query to return the age from the date of birth The query is executed. But it returns the age difference is in a negative value. Answer The problem with 2-digit year fixed – all years are treated as 19xx. https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=f356258c99b20d13b0c4e2349b801f18
What is wrong with the WHERE clause in this SQL query?
I fixed the syntax errors and it still won’t run. I keep getting the following error: unknown column ‘tblProduct.id’ in ‘where clause’ Note that there is a column ‘id’ in the table ‘tblProduct’ Answer MySql does not support full joins, the error does not d…
Using GROUP BY and JOIN-ing non-aggregated columns to query
I know there are many similar questions, but I haven’t managed to solve my problem by reading them. I’d appreciate some pointers. Here’s some example data from my dummy table below: id foo bar baz moo ins_date percentage yes no maybe 38 foothing bar_one pizazz amoosing 2018-05-26 06:59:00 81…