Not sure why this is happening, but I have this query: And the item table has 100 elements. I’m looking for the resulting rows to be grouped by user_id and have each array be 100 items long. That is, if the value is not present in the vote table, to just instead sub in a 0 in its place. Unfortunately
how to display data on 2 different date ranges
I have the following date data, which is used to display MySQL data parameters and I have the following query: The result I want is that the program will display data from date :$tgaw to date: $tgak Answer You should be using prepared statements here, and also use the MySQL functions to add one month to the u…
Flatten data source in Snowflake from Array
I am trying to fix an array in a dataset. Currently, I have a data set that has a reference number to multiple different uuids. What I would like to do is flatten this out in Snowflake to make it so the reference number has separate row for each uuid. For example Should end up looking like: I just started
Amend Report to use financial years and quarters
I need to amend this existing code to group by financial year (starts 1 July) and quarters, I realize that it is the below part of the query that requires amending but I can’t get it to work The full query is Sample data Lyaout as per below but with finacial yaer ^ qtrs shown instead of months Answer Be…
How do I make dates in a sample table more recent?
I have a table with about 5,000 records in a ‘sample’ database which has really old data i.e. the ‘Date’ field in this table has records from 2003. This certainly looks ‘old’ in product demonstrations …
Delete multiple rows in MySql without CTE
I have got a database with about 7000 cars, but unfortunately, only about 1000 are unique. Can I delete all the duplicated rows? The schema looks like this: Thank you!
Solve null date with case or if statement
I am wanting to process records for dates on an everyday basis. However I have a solution that will work incrementally but I need one that will load the first date if the table is null. Here is my …
How to Count Times an ID Appears in a Column in a Different Table
Apologies in advance: I’m sure this is relatively easy and has been asked ad nauseam, but I just can’t quite come up with the proper search. Basically, I’m trying to take a list of IDs queryed from …
Where clause with multiple conditions in SQL DB2
Desired Output: Query: Any help is greatly appreciated Answer Try this: dbfiddle example
How to make sum of rows value until sum value is 1.0 in SQL Server
I am stuck with this SQL Server query; here is my set of records: Name Value —- —- abc 0.7 xyz 0.4 pqr 0.6 ijk 0.3 fgh 0.1 cde 1.0 uvw 0.8 I want a query …