Numbers between two columns
Hello
I would like to create sequential numbers between these two columns of the specified table.
Existing data in the table
Column1 | Column2 |
---|---|
5 | 7 |
13 | 14 |
18 | 19 |
24 | 27 |
29 | 29 |
power required:
5
6
7
13
14
18
19
24
25
26
27
29
Could someone help me with this please.
Thank you.
XQUERY solution:
with
data in the form of
(select 5 Column1, Column2 7 Union double all the)
Select 13,14 in union double all the
Select 18,19 Union double all the
Select 24,27 Union double all the
Select double 29,29
)
Select n
data,.
XMLTable)
"xs:integer ($s) at xs:integer ($e).
passing of Column1 as "s",.
Column2 like 'e '.
columns
path number n '. »
)
/
N
----------
5
6
7
13
14
18
19
24
25
26
27
N
----------
29
12 selected lines.
SQL >
SY.
Tags: Database
Similar Questions
-
the list of numbers between two columns
Hello
I need the list of numbers between two columns.
My source table contains the intervals with different ranges and I'm currently thinking dividing them by size.
I was able to get a solution following the information contained in the Web page:
http://StackOverflow.com/questions/3971981/get-list-of-numbers-in-between-two-columns
The solution I've used is based on the following example:
But this doesn't work in my table if I have few and modest intervals (maximum 5 digits range).with t as ( select 10 startnum, 15 endnum from dual union all select 18, 22 from dual union all select 10000, 19999999999 from dual ) select lvl from (select level lvl from dual connect by level <= (select max(endnum) from t)) a where exists ( select 1 from t where lvl between t.startnum and t.endnum )
In the example, I was trying to understand why this might be failing, but I do not have a conclusion yet.
There is something I noticed and that I try to understand, that is:
If I change this query to:
It will increase from 2 to 3 seconds to return results to a few minutes at least (canceled after a few minutes!)with t as ( select 10 startnum, 15 endnum from dual union all select 18, 22 from dual union all select 19999999990, 19999999999 from dual ) select lvl from (select level lvl from dual connect by level <= (select max(endnum) from t)) a where exists ( select 1 from t where lvl between t.startnum and t.endnum )
Thus, using this example to understand if my problem is related to having many between start and end number or if it is linked with having small intervals between large numbers.
Can someone explain to me why I have this speed of different treatment depending on the value of the interval? And why it takes longer with the small interval?
I need to apply it to different beaches (from 2 ranges of numbers to 16 range) and in all ranges, I will have small intervals to check.
For example:
endnum startnum
7341 7342
7422-7423
7439 7456
2522200050 2522200054
2522200146 2522200150
4216969839880 4216969839884
4216969839893 4216969839897
Having this problem I can only ask the first values I have in the picture!
Best regards
Ricardo TomasHi, Ricardo,
Here's one way:
WITH cntr AS ( SELECT LEVEL - 1 AS n FROM ( SELECT MAX ( endnum - startnum) AS max_diff FROM t ) CONNECT BY LEVEL <= max_diff + 1 ) SELECT startnum + c.n FROM t JOIN cntr c ON t.endnum >= t.startnum + c.n ;
In your original query, you generate all the numbers from 1 to the highest endnum. You only need enough numbers to cover the range of startnum to endnum. (This method also works if startnum is less than 1).
Joins are usually faster than EXISTS subqueries. -
Thick border line between two columns
Hello all;
I have a requirement where the user must be able to distinguish between two columns hnce asking a thick line, rather than the usual 'by default'.
Everything is 'Default' until then.
I clicked on properties of the 1st column and in the section "Border", I chose "Custom" and made the right wall of the cell in black color.
I see a thick border now, but it has eliminated the 'default' border separating lines. His party make the entire column look like a single cell.
I don't want any change with the exception only of the border of a column of a black line.
Any help is greately appreciated.
Thank you!The column properties-> Options of Style CSS custom (HTML only)-> use custom CSS Style->
the following CSS code
border-right-width: 1px; border-right-color: green;or go with someone with the necessary changes
Appreciate if you score as correct if it works
Published by: Srini VIEREN on December 11, 2012 16:43
-
How to write a query for the data exchange between two columns?
How to write a query for the data exchange between two columns?
I tried a request, does NOT work.
Thank you.update tmp t1 set t1.m1=t1.m2 and t1.m2=(select t2.m1 from tmp t2 where t2.student_id = t1.student_id)
Published by: user533361 on October 23, 2009 14:04Just plain and simple:
update tmp t1 set t1.m1=t1.m2, t1.m2=t1.m1 /
SY.
-
Number of matches between two columns
Column1 Column2 5 5 5 2 5 5 4 3 4 4 Football match 3 I basically you want to compare two columns and count matches in the corresponding lines. I tried using the following formula:
SUMPRODUCT (--($column1=$column2))
... but it doesn't work! Any suggestion?
Tiago,
It seems you are trying to use array formulas (maybe since excel?) who do not work in number.
Here's how I would solve this problem:
Make sure that the table where data is named 'Data' (as shown, or change the table name references to match your table name)
Add a new column (C)
C2 = AND (A2 = B2, A2≠ "")
It's shorthand dethrone select cell C2, then type (or copy and paste it here) the formula:
= AND(A2=B2, A2≠"")
Select cell C2, copy
Select cells C2 at the end of the C column, paste
the formula say to check to see if the cell in column A is NOT empty, and is equal to the cel in column B
Now in the summary table (single cell table):
A1 = COUNTIF (Data::C, TRUE)
-
OBIEE: Cannot do the subtraction between two columns
I would like to see the difference between the expenses of the customer in the current from the previous period. Thus, each row contains data from a single client. And my first field (column A) lists the customer spending in the current field of the era and the second (column B) for the previous period. I tried to calculate the difference in my third field (column C).
However, given that some of the cells in column A are "null", the respective cells in column C appeared also as "null".
I tried to convert the column A 0 help ifnull null cells. But the respective cells in column C may not always do the subtraction.
Help, please! Thanks in advance.Hello
In the column C set Ifnull(Col A) - Ifnull(Col B) try this. I tried and it works for me.
-
Exchange of values between two columns
I have a MEMBERS_SYSTEMS_ID table with three columns ID, B1, B2.
I need to swap values between B1 and B2 for particular values of ID.
IAM trying the following but is not working, please help solve + [If you can also tell why my SQL does not work which would be awesome] +.
BEGIN
DECLARE the temp varchar (50)
UPDATE MEMBERS. MEMBERS_SYSTEMS_ID
SET temp = B2,
B2 = B1,
B1 = temp
WHERE ID IN ('85 ', ' 86');
ENDYou cannot update a variable as part of an update, only columns in the table. And, in fact, you don't have an intermediate variable, just do the update directly as:
SQL> SELECT * FROM t; ID DESCR1 DESCR2 ---------- ---------- ---------- 1 Descr2 Descr1 1 Other2 Other2 2 Two1 Two2 SQL> UPDATE t 2 SET descr1 = Descr2, 3 descr2 = descr1 4 WHERE id = 1; 2 rows updated. SQL> SELECT * FROM t; ID DESCR1 DESCR2 ---------- ---------- ---------- 1 Descr1 Descr2 1 Other2 Other2 2 Two1 Two2
John
-
How to use AS between two columns
Hello
If we have following columns, how can we use AS link tables
COLUMN A of table X COLUMN B of table Y
============== =============
74500000ADN 74500000FKGL
78920000KDE 78900000LJKE
2345454LKKLK 54545345FDFR
96226HIYYOPP 9622622KDJJG
"SELECT...". TABLE1, TABLE2 x Y WHERE X.colA LIKE Y.colB
Will the above work correctly?
(Must extract the line 1, 2 and 4 above)
Rgds
sexyHello
Yes, you're right.
I just wanted to show sexy using substr with a length of 5 would not bring the second row of its sample data.
If he wants to use a dynamic length, it should now be under what conditions a specific length should be used. -
calculation between two columns that depends on the minimum value
I have the table with the following values, how can auto calculation based to a minimum value to assign each line then?
Seq 1 reference ID price price of the difference % of difference 1 3 1500 2 3 3500 3 3 4000 calculation logic
the result should be...
Seq 1 reference ID price price of the difference % of difference 1 3 1500 0 0 2 3 3500 2000 1.333 3 3 4000 2500 1,666 Dev environment
service of Cloud Computing by oracle
PRODUCT VERSION STATUS NLSRTL 11.2.0.3.0 Production Oracle Database 11g Enterprise Edition 11.2.0.3.0 64 bit Production PL/SQL 11.2.0.3.0 Production AMT for Linux: 11.2.0.3.0 Production with
a_table as
(select 1 seq_1, 3 ref_id, 1500 Union double all the)
Select 2,3,3500 from all the double union
Select double 3,3,4000
)
Select seq_1, ref_id, price,
price - min (price) on differece_price (partition by ref_id by seq_1 order),
price / min (price) over (partition by seq_1 order ref_id) - 1 difference_percent
of a_table
SEQ_1 REF_ID PRICE DIFFERECE_PRICE DIFFERENCE_PERCENT 1 3 1500 0 0 2 3 3500 2000 1.33333333333333333333333333333333333333 3 3 4000 2500 1.66666666666666666666666666666666666667 Concerning
Etbin
-
How to find a number between two numbers?
I try to find the numbers between two given user numbers and multiply each of them, but my code so far wont allow me to separate the numbers multiply:
ex: the numbers are 5 and 10: my code gives me 5678910 together online.
How can I sneek the * between these numbers? I know that I am seriously close here's my work so far.
Any help is greatly appreciated.
import java.util.Scanner;
public class FindIt
{
Public Shared Sub main (string args [])
{
Console scanner = new Scanner (System.in);
int userNumber, finIn, finIn2, finIn3;
System.out.Print ("enter a lower limit > = 1 :"); ")
do
{
userNumber = console.nextInt ();
If (< 1 userNumber)
{
System.out.Print ("enter a lower limit > = 1 :"); ")
}
} while (< 1 userNumber);
System.out.println ("the lower limit is" + userNumber);
System.out.println ();
System.out.Print ("enter an upper limit > = 3 :"); ")
finIn = userNumber;
do
{
userNumber = console.nextInt ();
If (userNumber < 3)
{
System.out.Print ("enter an upper limit > = 3 :"); ")
}
} While userNumber < 3.
System.out.println ("the upper limit is" + userNumber);
System.out.println ();
finIn2 = userNumber;
int x, y;
y = 0;
for (x = finIn; x < = finIn2; x ++)
CallIncr();
}
}
Published by: 806590 on October 31, 2010 13:07
Published by: 806590 on October 31, 2010 13:09Modified the code of the loop to as below
for (x = finIn + 1; x)< finin2;="">
-
calculation of time between two time as timestamp
How can calculate two hour, START as the timestamp TIME in the data type, END TIME as of time also.
select END_TIME-START_TIME from PROG_DLY_WORK
Result
+ 01:50:00.000000 000000000
How can get exactly the time spent as 01:50 ? and these calculated time must sum (elapsed_time) in another column.
oracle as PaaS cloud environment
Product VERSION STATUS NLSRTL 11.2.0.3.0 Production Oracle Database 11g Enterprise Edition 11.2.0.3.0 64 bit Production PL/SQL 11.2.0.3.0 Production AMT for Linux: 11.2.0.3.0 Production Time difference between two columns in hours
Start
FOR REC IN (SELECT START_TIME, END_TIME, CALC_TIME CAL_ID)
LOOP
UPDATE CALc_TIME
SET ELAPSED_TIME = round (())
TO_DATE (to_char (REC. End_time, 'ddmmyyyyhh24miss'),
"ddmmyyyyhh24miss")-
TO_DATE (to_char (REC. Start_time, 'ddmmyyyyhh24miss'),
"ddmmyyyyhh24miss")
() * 24).
WHERE CAL_ID = REC. CAL_ID;
END LOOP;
end;
Lag in minutes
Start
FOR REC IN (SELECT START_TIME, END_TIME, CALC_TIME CAL_ID)
LOOP
UPDATE CALc_TIME
SET ELAPSED_TIME = round (())
TO_DATE (to_char (REC. End_time, 'ddmmyyyyhh24miss'),
"ddmmyyyyhh24miss")-
TO_DATE (to_char (REC. Start_time, 'ddmmyyyyhh24miss'),
"ddmmyyyyhh24miss")
() * 24 * 60)
WHERE CAL_ID = REC. CAL_ID;
END LOOP;
end;
-
Simple query to find the difference between 2 numbers in one column to another column
Hello
I would like to know the difference between 2 numbers in same column corresponding to a condition of another column. How do that?
For example: say I have a table with 3 columns A, B and C.
A > Varchar2
B > Varchar2
C > number
A B C A D 1 B C 2 C B 3 D A 4 I want something like 'column value corresponding C min min (col B) result = (col A) - value of the corresponding C column (number)' without having to write 2 select statements. How do I do that?
Thanks in advance
aBBy007
Notes on the system:
2-node 11.2.0.3.4 GI/RDBMS running on RHEL5.
Hello
It is not very similar to your original question. It would be better if you asked what you really want in your first post, rather than making people to time writing solutions you want not and can not use waste. Once you see an answer to this question, will you change the question again?
Here's a way to do what you asked:
WITH got_lasts AS
(
SELECT val.thread #.
, MAX (val.sequence #) AS last_standby_seq_received
MAX (CASE
WHEN val.applied = "YES".
THEN val.sequence #.
END
) AS last_standby_seq_applied
V $ archived_log val
Join v$ database vdb WE val.resetlogs_change #.
= vdb.resetlogs_change #.
GROUP BY thread #.
)
SELECT thread #.
last_standby_seq_received
last_standby_seq_applied
last_standby_seq_received
-last_standby_seq_applied AS total_lag
OF got_lasts
ORDER BY thread #.
;
-
Pages 5.6.2 switching column numbers between sections
I use Pages 5.6.2. I am trying to go in a section of 2 column 1 column to another. He used to work which sections could have different layouts. Now, when I change the column number in a section it changes all sections. Does anyone know why this is or how to fix it?
This is especially weird because I have a document that goes from 1 column in the intro, and then 2 columns, and it is fine. I could have done it in 5.6.1 or more. It may be a new deletion of feature?
Pages v5.6.2 and OS X 10.11.5.
Pages ' 09 v4.3 had a Section layout that has been removed from all Pages v5 releases. You have reason v5.6.2 Pages refuses now to two columns in a single section, return to a column in the next section - even when the de-selection of the section previous match - on the tab of the Section of the document Panel. I always try to game it works correctly.
-
Difference between two date columns
Dear professionals,
How to get different between two columsn (sati_do-sati_od) in format HH24:
where this results in:select to_char(sati_od,'hh24:mi') "hh:mi format", to_char(sati_do,'hh24:mi') "orginal_value_col2", sati_od "original_value_col1", sati_do "original value", sati_do-sati_od "Difference" from accbtp_pliskljucenjaodobrenja where idplisklj= 22999;
THX in advance, Adnanhh:mi format orginal_value_col2 original_value_col1 original value Difference ------------ ------------------ ------------------------- ------------------------- ---------------------- 09:00 15:00 01.12.10 01.12.10 0,25 09:00 15:00 01.12.10 01.12.10 0,25 09:00 15:00 01.12.10 01.12.10 0,25 09:00 15:00 01.12.10 01.12.10 0,25
select trunc( mod( (e-j)*24, 24 ) ) ||':'||trunc( mod( (e-j)*24*60, 60 ) ) "Hr:Mi" from ( select t.*, trunc(sysdate,'y')+jd+jh/24+jm/24/60 j, trunc(sysdate,'y')+ed+eh/24+em/24/60 e from t ) t
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:96012348060
-
Hello
I use Apex 4.1, them 24.
I have two regions, one in column 1 and the other in column 2. My problem is that there is no space between two region, is it possible to define this space without creating a new zone of empty space between them?Hello
It depends on your page template. In General,.
Don't use columns.
Use the same column for both regions.
use the same point on the screen.
in the attributes of the region A region, put this:Style = "width: 45%; margin-right: 2%; ' float: left '.
in the region of the attributes of region B, put this:
Style = "width: 45%; float: left; "clear: No.
-change the percentages at your convenience, but make sure that the sum of all the numbers does not exceed 100.
However,.
Please check the attributes of the region of the regions on the first page of the sample application. (After changing the theme of this app in topic 24)Kind regards
FatehPublished by: Fateh on 19 October 2012 23:40
Maybe you are looking for
-
Qosimo G20-139, gel UK Freeview photos!
Hi all. Everyone out there in the United Kingdom. with a brand new G20-139?You have problems with the HYBRID TV. DIGITAL TUNER. ??. The images are great, but they freeze for a few seconds at a time [not on a regular basis]. DTT signals are perfect, a
-
Problems of NAT for Xbox a Live, AC1900 Smart WiFi router model # R7000
I can't get NAT open for my Xbox One, it is set to moderate right now. I tried to turn NAT, filtering to open, address reservation, go wireless Ethernet, port forwarding / port triggering TCP/UDP 3074. Any help would be appreciated
-
LELA, Win XP SP3 &; WRT300N
When I upgraded to Win XP SP3 LELA stopped working properly. I tried to reinstall LELA, but she won't recognize just is no longer the router. I have a WRT300N and were using LELA version 1.6.0033 up to this point. Y at - it another version of LELA
-
tell business-pc Vista is connected-don't support ie7 page-i read somewhere that we can change the ipv6 configuration in the registry so that it uses ipv4 more effectivly
-
After the printer warms up (30 minutes) the screen goes white, backlight always on, turns off the network. Power cycle still not good. Turn the printer off for a few hours printer works fine until it heats up again. Replaced trainer, DC controller,