Current Result: ID | Item | Red | Green | Blue | Yellow 03 balloon 1 0 0 0 03 balloon 0 1 0 0 03 balloon 1 0 0 1 24 ribbon …
Tag: case-when
SQL group by ID for multiple IDs using case when statements
I started with a list of patients with multiple codes (at multiple times of year) and need to split the patients into groups based on if they have a code or combo of codes and those that don’t qualify …
How to transform one SQL column into multiple columns on the same row?
I am working in a Progress ODBC in Excel and I have a data set that currently holds an ID, Object type and the result for that object. The dataset looks a little like below: EveNumber …
SQL Table Valued Function – Return certain data from ‘WITH’ based on parameter value
I am trying to do a “with” to loop through some data (which its doing fine). But after that with, I want to return data dependent on a bit parameter. Its important that this is inside a function. …
Based on Condition Extract Values Right of String
I have a dataset in sql that looks like this: Col1 Col2 13_DND_ 5 _DND_ 6 123_ETL_ 10 ETL_ 12 DND_ 15 _ETL_ 17 If Col1 contains either _DND_ or …
CASE clause in WHERE
I’m doing a leetcode question. 2 similar answers are worked out. But I have no idea why one is wrong and the other is right. The following is the question link. The goal is writing a SQL query to find all numbers that appear at least three times consecutively. https://leetcode.com/problems/consecutive-numbers/ The table looks like Right version: The output: Wrong version:
How to look if the value reoccurs in the table after current selection in SQL
I have below data table [CRA_feasibility_test] atmid CRA monday tuesday wednesday thursday friday saturday DA0068C1 ABC Y N Y N N Y I …