I have a SQL using XMLTable to retrieve tag values such as Tag>Value</Tag which works fine. But what about value/condition inside the tag? See following XML with tag T2 having a remove condition = true. How can I retrieve that condition using XMLTable? Answer Pretty much the same way, just use the XPath…
Tag: oracle
Different sort results between Oracle and Postgres with Special Characters
*Apologies as I know this question has been asked before, but tried the previously suggested approaches and none fixed my issue. I am trying to compare a table found in two databases. Unfortunately, the table does not have a primary key, so I am trying to order by the same column and compare that way. When I …
All tables consisting of numbers less than a fixed number
I am trying to find out all the tables where table names consist of numbers less than a fixed number 16284961 at the end preceded by an underscore for example LOG_16282961. Sample User_segments table: Expected Output: Query: Using above query, although I am getting my result but additionally it also includes …
sort with special sort number
I have two tables, sort table and assign table SortID Name 0 A 1 B 2 C 3 D I want assign mission to everyone, start with a special sortID example: start with sortID 2, and change order next week. result as below: Date Week MissionA MissionB MissionC MissionD 2021/1/3 1 C D A B 2021/1/4 1 C D A
how to get start date of latest dept in which working
I’m trying to get the record of emp current working dept with start date Data, in below data Grp column is I’ve derived to get the 3rd last record, which is the correct result. query tried so far Am not able to think ahead, that how can I use Grp now to get 3rd last record as a output. Data
Oracle – get previous, current and next year from query [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year. Improve this question Is below example good solution for get previous, current and next year?…
Return row per key based on precedence in Oracle’s SQL
I have data as below. Some items have more then one type id. I need to select only one from each id. My condition is that if exists (type id of item == 1) select only that row; if not exists type id is 1 check if exists (type id of item == 2) select that row; if not exists
Date Entry of SQL ORACLE
Here I am using Oracle SQL and I have a table with 2 columns, Keyword and Created_Date. Is there any way to get the 3rd column with information of next entry of 2nd column in accordance with first column? Thanks guys Answer Looks like the LEAD analytic function. Sample data in lines #1 – 10; query begin…
Oracle SQL: check amount of active users on given date (check closest date of grouped field)
Have a table given, holding the status history of a user: ID USERID MODIFIED STATUS 1 1 01.01.2020 inactive 2 1 01.07.2020 active 3 2 04.08.2020 active 4 2 04.06.2020 active 5 2 01.08.2020 inactive 6 2 01.10.2020 active 7 3 01.09.2020 inactive I want to provide a date, i.e. 01.07.2020, and understand how many…
Remove duplicate values from comma separated variable in Oracle
I have a variable (called: all_email_list) which contains 3 email address lists altogether. (I found some similar question but not the same with a proper solution) Example: test@asd.com, test2@asd.com,test@asd.com,test3@asd.com, test4@asd.com,test2@asd.com (it can contain spaces between comas but not all the …