I have the data below, and i want to get the last row per desc the result should be like this: how can i do it in SQL, please note that database is oracle. Answer You can get the expected result with the following query:
Tag: sql
How to split one column with array merge value to array and join other table then merge back
There’s a table WaitCheckBil like : and a table Users like : Expected result : What I’ve tried & think : It’s a old system’s table , so I can’t change the struct. And the table logic is select * from WaitCheckBil where usrs like ‘%;’ + @usr + ‘;%’; to …
Delete xml node with a specific CDATA
This is part of my XML: I need to delete the EO node with <![CDATA[0001FFFFFFFF]]>,across the table using Oracle. This xml is stored in XM_DATA_CACHE of XMLTYPE. Is there a way to delete based on CDATA Final output should be Answer First of all your xml is broken: second tag GoalMeasurementEORow is not …
How to group data if difference between rows is mothe than 1 minute
Im trying to create a new table on SQL which will have summarized data. For example. In the original table i have this data: If you see rows 9, 10 and 11 they are consecutive, so i want to group them …
Postgresql, one function calls another function and get 2 out values to caller
Postgresql 12. Want to call function testA() from another function testB(), and assign two “out” values to the 2 local variables. Don’t know how to do the assignment, please help. create or …
Postgresql – Select in Select Alias Problem
I have query. https://dbfiddle.uk/?rdbms=postgres_12&fiddle=1b3a39357a5fe028f57b9ac26d147a1d SELECT users.id as user_ids, (SELECT ARRAY_AGG(DISTINCT CONCAT(user_has_bonuses….
Query puzzle – how can I select values with fallbacks?
I have a table with 6 columns as follows: CREATE TABLE `test_table` ( `id` bigint UNSIGNED NOT NULL, `A` varchar(255) NOT NULL, `B` varchar(2) NOT NULL, `C` varchar(50) DEFAULT NULL, `D` …
Use a calculated column value to look up a specific value from the same source table
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…