The selection of two different tables when a value is null or zero in one
Hi friends,I have two tables where the data of...
so now I have to display the value of tab1.value and if the value that it is) or null I should poster from another table viceversa
tab1. Value 100 tab2.value 0
now I get the value of tab1.value
tab1. Value null tab2.value 200
now, I should get the value of tab2.value
If tab1.value is 0 and tab2.value is 0 then display 0
How to do this
Thank you
select prrv.result_value,
pg.attribute3,
case
when prrv.result_value is null or prrv.result_value = 0 then pg.attribute3,
else prrv.result_value
end
from per_grades pg,pay_run_results prrv
where prrv.id=pg.id
/
SY.
Tags: Database
Similar Questions
-
I have the data into two table with the structure of similar column, I want to loop through the data in these two tables
based on some condition and runtime that I want to put the query in loop for example, the example is given, please help me
create table ab (a number, b varchar2 (20));
Insert into ab
Select rownum, rownum. "" sample "
of the double
connect by level < = 10
create table bc (a number, b varchar2 (20));
Insert into BC.
Select rownum + 1, rownum + 1 | "" sample "
of the double
connect by level < = 10
declare
l_statement varchar2 (2000);
Boolean bool;
Start
bool: = true;
If it is true, then
l_statement: =' select * ab ';
on the other
l_statement: =' select * from bc';
end if
I'm in execute immediate l_statement - something like that, but I don't know
loop
dbms_output.put_line (i.a);
end loop;
end;
Something like that, but this isn't a peace of the code work.
Try this and adapt according to your needs:
declare
l_statement varchar2 (2000);
c SYS_REFCURSOR;
l_a number;
l_b varchar2 (20);
Boolean bool;
Start
bool: = true;
If it is true, then
l_statement: = "select a, b, AB;
on the other
l_statement: = "select a, b from bc;
end if;
--
Open c for l_statement;
--
loop
extract the c in l_a, l_b;
When the output c % notfound;
dbms_output.put_line (l_a |') -' || l_b);
end loop;
close c;
end;
/
-
Select Max (Date) in two different tables...
Dear all,
I need the date of last update of two different tables, I mean max (date). We will update one table at a time. Updated once I need to take the last update.
It can be either in table A table B.
for example.
Table A
Date of the ID
100 16/05/2014
101 20/05/2014
102, 22/05/2014
Table B
Date of the ID
100 04/06/2014
101, 26/05/2014
102 21/05/2014
I need the date of table B (101 26/05/2014) last updated date...
Hello
Another way, using much more GRAND:
SELECT LARGER (max1, max2) x
FROM (SELECT MAX (mydate) max1
OF mytable_a
)
(SELECT MAX (myotherdate) max2
OF mytable_b
)
;
Best regards
Bruno Vroman.
-
Process in two different tables in one page
Hi all
I have A form with a submit button, when I click on the button I want to send the data from two different tables. For example:
REQ_ID: 221
BOX_NUMBER: 2
NOM_ELEMENT: APPLE
COUNTRY_ORIGIN: USA
I want to send all the information in table 1 and only REQ_ID and BOX_NUMBER in table 2.
I tried to create processes two different which are:
1. the usual process line DML for table 1 and;
2. simple query 'Insert' SQL for table 2
It seems fine, until I realized that when the user tries to update the BOX_NUMBER to 10 for example, only 1 table is updated and table 2 creates an another duplicate data instead of updating the old one! This also applies to my button Delete,.
any idea to fix this problem?
Thank you very much
Vika
Reread what you wrote and you would realize why 2nd table only "new lines".
2. simple query "Insert into ' SQL for table 2
If you need to UPDATE the table, then you must write a simple UPDATE statement.
If you want to REMOVE from the table, then you must write a simple DELETE statement.
I call this "DML DIY" - do it yourself DML
(personally, I'd probably use MERGE for INSERT and UPDATE)
MK
-
Insertion of records in two different tables at the same time?
Hello everyone, I have question about inserting records in two different tables at the same time, I'm looking for is by the way a unique id, which is created in the first statement insert to the second insert statement. Example of this problem:
< cfquery name = "addRecords1" datasource = 'test' >
Insert Into Table1 (name, Date, age)
Values (< cfqueryparam cfsqltype = "cf_sql_char" value = "#arguments.) "Name # ' >.
< cfqueryparam cfsqltype = 'cf_sql_date' value = '#arguments. "Date # ' >.
< cfqueryparam cfsqltype = "cf_sql_int" value = "#arguments. Age #"(>); "
Select SCOPE_IDENTITY() as RecID;
< / cfquery >
< cfquery name = "addRecords2" datasource = 'test' >
Insert into Table2(Company,City,Date,ID)
Values (< cfqueryparam cfsqltype = "cf_sql_char" value = "#arguments.Company #" >,)
< cfqueryparam cfsqltype = "cf_sql_char" value = "" #City # ">,"
< cfqueryparam cfsqltype = 'cf_sql_date' value = "" #Date # ">,"
( < cfqueryparam cfsqltype = "cf_sql_int" value = "How to pass RecID to insert in this table?" >).
< / cfquery >
In this example, I'm inserting records in table 1 and creation of IDENTITY SCOPE as RecId. I would like to pass this id and insert it in my table 2. This Id, I'll use in my second table as an identifier. If anyone knows anything about this please let me know. Thank you.
); QueryName - DOT - ColumnName, so it should be:
); HTH,
^_^
-
extraction of unique records of registration of two different tables
Hello
In the following two tables different www.testing.com code exists in both tables. I want to compare two different columns from two different tables for unique records.
Thank you and best regardsSQL> select unique(videoLinks) from saVideos where sa_id=21; VIDEOLINKS ----------------------------------------------------------------------- www.testing.com SQL> ed Wrote file afiedt.buf 1* select unique(picLinks) from saImages where sa_id=21 SQL> / PICLINKS ----------------------------------------------------------------------- test test14 www.hello.com www.testing.com
Try
Select unique (videoLinks) in the saVideos where sa_id = 21
Union
Select unique (picLinks) in the saImages where sa_id = 21 -
How to get into two different tables in two columns of a listbox of multi column
Hi all
I have two different tables of the values assume that table 1A (1,2,3,4,5) and another table B (3,4,5,6,7). I want to write these tables in a multicolumn listbox such as 1st column would be A array and 2nd column table B.
Thnx in advance
Saki,
I hope this helps to further
-
Updated all the selected lines in a table.
Hello
Jdev Version 11.1.2.3.0
I'm trying to update all the selected rows in a table with several choices.
AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl"); ViewObject vo = am.findViewObject("RegistrationHistory1"); RowKeySet selectedRegistrations = historyTable.getSelectedRowKeys(); if (selectedRegistrations != null) { Iterator iter = selectedRegistrations.iterator(); while (iter.hasNext()) { Object facesTreeRowKey = iter.next(); Row[] row = vo.findByKey((Key)((List)(facesTreeRowKey)).get(0), 1); if (row != null && row.length == 1) { Row r = row[0]; r.setAttribute("Attr", "1"); } } }
But after I put the attribute on the line. My iterator ignores most of the lines and they don't last updated.
It works very well for the removal of the line well.
Any suggestions?
It turn out that I got a try catch and in the catch, I had a log (e.printStackTrace ()) and I do not see a single line in the diary saying ConcurrentModificationException appearing all the time.
Looks for read-only access to an attribute or delete lines is OK to iterate over the selected lines, but it's different for the modification of an attribute.
The code that worked:
Links DCBindingContainer = (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();
Entry DCIteratorBinding = bindings.findIteratorBinding ("RegistrationHistory1Iterator");
RowSetIterator regRSiter = regIter.getRowSetIterator ();
RowKeySet selectedRegistrations = historyTable.getSelectedRowKeys ();
Object [] keys = selectedRegistrations.toArray ();
for (Object key: keys) {}
Line currentRow = regRSiter.getRow ((Key) ((List) key) .get (0));
removeOrModify (currentRow);
}
-
To find common data in 2 columns from two different tables.
Hello
Could someone help me with a querry to discover common data of 2 columns from two different tables?
Thank you
RajeshTry as below.
select col1 ,col2 from tab1 intersect select col1 ,col2 from tab2;
-
What happens if I am connected to the internet through two different sources or more?
What happens if I am connected to the internet through two different sources or more?
You get Internet from two sources. What did you expect to happen?
This is not double the speed of anything...
-
Hello. Editor of newbie here. If I split a video file into two clips in Premiere Pro and you want then save each one as a different file while exporting to the encoder, how to make sure that they are registered in the form of two different files with different after encoding names?
Located in and out on a section and that export brands.
.. .Rinse and repeat for the other section.
Name each section and where it is exported to separately... and as you wish
-
How to track the message to two different queue using jms proxy service
Hi all
In my project, I need to listen to a jms queue, then forward the messages to the queue of two different.
Now, I already have a proxy for listening to the queue and then pass it to another queue using business service, it works.
But how to forward messages to two different queues in the same workflow process using a proxy and bs?
or in any other way?
Really thanks in advance.
Kind regards
KahlilYou can use actions to publish in the pipeline to achieve this.
-
view the code for two different pages at a time
HI - in other editors I've used I've always been able to implement the code for two different pages so that I can watch side by side to compare. I can't find a way to do this in Dreamweaver. Anyone know if this is possible?
Thank youFound. Always after asking for help! This is the "cascade" in the Windows menu.
Thanks anyway! -
I'm an old Geezer Mac, but a Newbie iCloud. I just put on my two Macbook Pro iCloud email addresses and access e-mail through Apple Mail on both computers. Here are my two questions:
(1) iCloud emails disappear at the time of my Macbook Pro when I delete a message from iCloud of one of them?
(2) if I move an e-mail message to iCloud Inbox Mail at Mail Archive on a Macbook, can I delete the message from the second Macbook without losing the archived message?
Yes, that is what is supposed to happen with an IMAP e-mail account.
If you move it to a folder on the Mac, not in the iCloud account, you can remove safely icloud.
-
How to get the value of EV - the diiference between two different columns
Hello
I get the difference between the two different columns of two different... as tables (emp.sal - dept.comm)... all I want is I need only the records that a negative gap how get this? Please help me
Thanks in advanceIf I understand your question right:
select case when emp.sal-dept.comm>=0 then YOUR_VALUE else emp.sal-dept.comm end difference_value from emp,dept...
or do you want to:
select ... from emp,dept... where emp.sal-dept.comm<0
?
Kind regards
Sayan M.Published by: xtender on 19.11.2010 22:29
Maybe you are looking for
-
Hello Just got my x 240-everything works as expected. However, I get a notification to activate my windows? It came preloaded with windows 8 and is currently on - but says that it will be completed in November. Everytime I try and turn it on I get th
-
Error 200320: SCXI-1001 Chassis - Mod 1502
Hello. I'll put a SCXI-1001 chassis with several modules, 3 of them 1502 with their 1314 terminal blocks for the first time. I used this chassis before reading temperatures and worked fine, so I'm sure that the problem is me. I get this error 200320
-
TouchSmart 520 keyboard does not
Yesterday, I was using my computer when the keyboard suddenly stopped working. I jumped the old batteries, which lasted for a while (Duracell curiously) and put in 2 AAA Energizer batteries. I go back and the keyboard will not connect. I know the
-
Cannot install HP deskjet F4580 on windows 7
I really hope that someone can help me because this is drivig makes me crazy I just bought this printer and can not install on windows 7 I just got message saying appoerating system is windows 7 and a link to this site for windows 7. I tried to insta
-
Pavilion 17-e039sb USB controller
I bought a HP pavilion 17-e039sb notebook PC 64-bit (intel core i3-3110) with Windows 8. I formatted all drives, then install Windows 7 (SP1). Everything works fine, only the USB controller and bluetooth refuses to function. I searched a long time tr