Need help with a situation, I need to extract a specific value from a column containing string. The string varies over different records, but the value I need to extract is always preceded by the word “VERSION” I tried to user REVERSE & SUBSTRING but not able to get exact results. Any help wil…
SQL to get all combination with intersection of events
I have a table(transaction) with consumer_id and item_id. I want to output all combinations of items and number of customers purchased both the item. How can this be done in SQL. Transaction : …
Adding missing records from another columns in a different table
I have 2 tables : Table A: A | B | C | D qwe 4 2019 10 qwe 2 2020 5 qwe 5 2019 5 Table B : A | B 3 2019 4 2019 5 2019 6 2019 7 2019 8 2019 9 2019 10 2019 11 …
How to do sub-string calculations in SQL?
I am working with a table full of customer online orders. Each order has a company code which can be either ’09’, ’07’, ’04’, ’03’, and ’01’. Each order has an order number that looks something like …
Duplication of results after selecting data from two tables with the same values
Good day! I’m having a problem in duplication of results when I’m selecting data from two tables with the same values. I have one data in my first table homepost with an ID of 2 and I have three data …
SQL query for key and value
I need to write a query that does the following. After searching various forums I see “PIVOT” is one of the ways to implement this. I am still trying to write an query using PIVOT but in the meantime …
How to show the summation in each row of a measure with some conditions? [closed]
Let’s suppose that I have the following data: CustomerID->Number->Date 1->2->1/1/2019, 1->3->2/1/2019, 2->1->1/1/2019, 2->6->2/1/2019 I want to have a column let’s …
Model not returning value when one field used in select
I have a question with my if statement. I want to get check what is bigger than another price value. one value is saved in my database table and another one is getting with input value. but I wrote …
How can I use rank function to solve this?
I have this data: and I want to this result: So I ve tried this: but it did not solve my problem. How can I solve this issue? thanks in advance Answer DENSE_RANK not RANK:
Oracle SQL: select count of multiple distinct fields
I need to select id, type and count of rows with unique id-type combinations. So I tried something like this: SELECT ID, CASE WHEN /**/ THEN ‘FIRST’ WHEN /**/ THEN ‘ANOTHER’ …