I have a table in SQL Server called ShippingDocSummary which contains all historical records for shipping documents. For a given document number, there can be any number of historical records/…
SQL query to count the number of rows in different columns with group by clauses
In my Mysql database, I have 2 columns that store the start and end date of the process, respectively. I need to write a query that allows me to count the number of rows for each month in each column, …
Extract the second word from a string in ODI Expression
This two syntaxes allow to get the scond word from a string in oracle Result: I’m working in ODI (oracle data integration), this two syntaxes doesn’t work in ODI: For ODI, the regexp is not valid and INSTR function accepts only 2 parameters Can you suggest me a solution that can work in ODI? Thank…
Rank based on cumulative value
I want to rank on ID and value columns based on ascending order of UID. Expected output has to change once value column has a different value than the previous value. Ranks has to restart on each new ID Here is a sample dataset that I have created: Answer I think that the simplest approach to this gaps-and-is…
Is It Possible to Round a Number Smaller Than 1 In SQL While Keeping In Decimal Form
I am not finding the solution to this issue despite looking specifically for it. The below query is me trying to get the last decimal places to appear properly. select CAST(CAST(33 as float)/100 as …
How to separate a value taken from a table row and store it in an array in a snowflake
I need to return an array in the stored procedure that takes a comma separated string value from a table and divides that string based on the comma and stores them in an array. Example: My table has a Column Tab_Val with row value as “COL1,COL2,COL3,COL4”, I need to take this row in my stored proc…
How do you count and list number of occurrences of a phrase or word separated by a semicolon in a string in SQL?
I have a column that has values formatted as shown in quotes. “Promotion – External; Outside Hire; Reassignment – External; Promotion – External; Promotion – External; Promotion – External; …
Oracle PL/SQL SUM OVER( ) starting from certain row
I have a table who looks like this: Pam_A Week Value_1 A 1 10 A 2 13 B 3 15 B 4 10 B 5 11 B 6 10 I want to achieve …
Creating required script
My question is about select statement. I have a table called test1 and the values in it. Here my script for creating the table, and inserting values: create table test1(id number, pc number, pe number)…
Why am I getting a CASE error when in Data Studio?
I’m trying to convert a four-digit numerical code to a four-digit (one letter + 3 numbers) with a CASE clause in Data Studio. The four-digit numerical code is being pulled out of a Sheets file. I keep …