Find columns that exist in one, but that do not exist in another table?
I ' having a slight problem. I can't find an appropriate SQL query to return values for a column that exist in a table, but that do not exist in another (related).TABLE CAR
(
PK CAR_ID,
CAR_TYPE
)
TABLE CAR_IN_REPAIR
(
PK ID,
FK CAR_ID,
FK REPAIR_SERVICE_ID
RETURN_DATE (NULL)
)
I want to show the records that appear in the table of the CAR, but who are not in the CAR_IN_REPAIR and that CAR_IN_REPAIR. RETURN_DATE is less than SYSDATE or zero (date of return unknown).
In short, I want the query to display the cars that are currenty in repair or does not know the date of return from the repair center (NULL)
I did a SQL query:
SELECT c.id
DRIVE c, CAR_IN_REPAIR r
WHERE c.id NOT IN r.car_id
the query returned no data but data is in the table of the CAR because he displayed when I SELECT * CAR?
Published by: OraNewbie on August 28, 2008 21:02
Try this-
strikeselect * from CARminusselect * from CAR_IN_REPAIR--strike--
select *
from CAR c
WHERE c.id NOT IN (
select r.car_id
from CAR_IN_REPAIR r
)
Hope this will help you.
Kind regards.
LOULOU
Published by: Satyaki_De on August 29, 2008 12:35 AM
Oops! The table structure is different...
Published by: Satyaki_De on August 29, 2008 12:38 AM
Tags: Database
Similar Questions
-
How to create a table with a column that is the value in another table?
Hi all,
It's my first post n I changed my ODI of DATASTAGE platform. Help me friends n I know basic steps in 11 ODI version which I was training in my company. I hope to have your support and can do everything an action ODI related documents.
My question is...
Table T1 > > > > > > > > > >
service id / / / attr.name / / / attr.value
S1 / / / product_code / / / P1
S1 / / / provider / / / pro1
S2 / / / product_code / / / P2
S3 / / / provider / / / pro3
Table T2 > > > > > > > > > > > > > > >
ID / / / product_code / / / provider
S1 / / / p1 / / / pro1
S2 / / / p2 / / / nullvalue
S3 / / / nullvalue / / / pro3
I have a table T1 since I should show the table T2 is released. Can we say everything on how to write a logic and steps to follow.
Thanks in advance.
Published by: 854662 on April 26, 2011 01:59Hello
U go.
1 the interface:
"Put a filter in your 1 on attr.name = array ' PRODUCT_CODE.
In the map target TABLE2
SERVICE_ID = TABLE1. SERVICE_ID
PRODUCT_CODE = TABLE1. ATTR_VALUEUse SQL IKM append control
Interface 2:
"Put a filter in your 1 on attr.name = array ' PROVIDER '.
In the map target TABLE2
SERVICE_ID = TABLE1. SERVICE_ID
PROVIDER = TABLE1. ATTR_VALUEDo SERVICE_ID as KEY (when you click the column target in properties, you can see KEY under properties of the target column) and use the incremental update of the IKM Oracle.
PS: I assume that Oracle as the source and target.
And you can refer to the documentation,
https://Apex.Oracle.com/pls/Apex/f?p=44785:24:4413167952886630:no:24:P24_CONTENT_ID, P24_PREV_PAGE:5185, 29
http://odiexperts.com/
And of course this OTN.
Thank you
Guru -
The column that does not match when comparing two records
Hi all
We try to compare two tables and find the differences. So if two records (1 of each table) have same PK but not always matching because of some columns, then we would display this columnname. For example:
Table 1
PK Parent Child Property1 Property2 1 A A1 P1 PR1 2 B B1 P2 oraPR2 3 C C1 P3 SRP Table 2
PK Parent Child Property1 Property2 1 A A1 P1 PR1 2 B B1 P2 PR2 3 C C1 P3 PR4 In the above example when I compare 2 tables all matches except Property2 online n ° 3. Thus, we would like to get an output like:
PK Column_Mismatch 3 Property2 (this must be the name of the column that does not match) Appreciate the help.
Thank you
Andy
Hi, Andy.
Andy1484 wrote:
Hi all
We try to compare two tables and find the differences. So if two records (1 of each table) have same PK but not always matching because of some columns, then we would display this columnname. For example:
Table 1
PK Parent Child Property1 Property2 1 A A1 P1 PR1 2 B B1 P2 oraPR2 3 C C1 P3 PR3 Table 2
PK Parent Child Property1 Property2 1 A A1 P1 PR1 2 B B1 P2 PR2 3 C C1 P3 PR4 In the above example when I compare 2 tables all matches except Property2 online n ° 3. Thus, we would like to get an output like:
PK Column_Mismatch 3 Property2 (this must be the name of the column that does not match) Appreciate the help.
Thank you
Andy
Why you don't want no matter what exit for pk = 2? Property2 does not correspond either to pk.
What happens if the 2 columns (or more) do not match? The following query would produce a list delimited, such as ' parents; PROPERTY2 '.
WITH got_mismatch AS
(
SELECT pk
, CASE WHEN t1.parent <> t2.parent THEN '; PARENT' END
|| CASE WHEN t1.child <> t2.child THEN '; CHILD ' END
|| CASE WHEN t1.properry1 <> t2.property1 THEN '; PROPERTY1 ' END
|| CASE WHEN t1.properry2 <> t2.property2 THEN '; PROPERTY2 ' END
AS the offset
FROM table_1 t1
JOIN table_2 t2 ON t2.pk = t1.pk
)
SELECT pk
, SUBSTR (incompatibility, 3) AS column_mismatch
OF got_mismatch
WHERE mismatch IS NOT NULL
;
If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.
The query above does not count NULL values as inadequate. If you want that, the same basic approach will work, but you can use DECODE instead of <> to compare columns.
What happens if a pk exist in a table, but not the other? You want an outer join, where I used an inner join above.
-
How can I find photographs that are not assigned to any collection?
Hello!
I use LR 5.7.1 on a Mac.
When I've airbrushed raw with PS CC images (and do not need file PSD more) I export the PSD (which is in my catalog) in JPG format and let it automatically add to my catalog. After that, I remove the PSD file. Which works very well.
But... the new JPG file is not assigned to any collection. This is no problem unless I forgot to do it manually after export (and import).
This brings me to my question.
How can I find photographs that are not assigned to any collection?
I tried with a smart collection after I found nothing suitable in the filter library. The search criteria, I tried are Source-> Collection with any of the conditions. One with an empty field, then with just a space and so on.
Does anyone have a good tip for me?
Thomas
You can also add numbers if you have collections that do not use characters of the alphabet.
-
How do the display column that is not in the subject box.
Hi all
I have a requirement to report where I show a column that is not discipline.
for example, obligation to report is like where I need the columns from 2 different subjects.
1 in. and part 2 of the Bill.
now, I have linked IN. details of invoice discipline, but one column is missing.
Rite now I m capture this column related details report separate and I'm passing values to the main report.
But what happens if I want to display this column in the main report.
Please let me know your inputs...
Thanks in advance...You can do it in 10g using the Advanced tab in the answers. Scroll to the part of the link that says, "against the two domains (multiple domains)."
http://gerardnico.com/wiki/dat/OBIEE/multiple_subject_area
-
way to find vm that are not removed from disk
Is it possible that I can find, vm that are not removed from disk
That is to say that "take inventory" but I forgot to remove the disc.
Thank you
If you only need a report, you can do it like this (I've made a few changes to your script).
$unregistered = @)
foreach ($Datastore in (Get-Datastorecluster xxxx |)) Get - Datastore)) {}
# Collect .vmx paths of virtual machines stored on the data store
$registered = @ {}
Get - VM - Datastore $Datastore | %{
$_. Extensiondata.LayoutEx.File | where {$_.} Name - like "*.vmx"} | % {$registered. Add ($_.) Name, $true)}}
# Set up the search. VMX files in the data store
New-PSDrive-name TgtDS-site $Datastore - PSProvider VimDatastore-Root '-' | Out-Null
$unregistered += (@(get-ChildItem-Path TgtDS:-Recurse |)
where {$_.} FolderPath - notmatch ".snapshot" - and $_. Name - like "*.vmx" - and! $registered. ContainsKey ($_.) DatastoreFullPath)} |
Select DatastoreFullPath))
Remove-PSDrive-name TgtDS
}
$unregistered | Export Csv c:\temp\vm-unregister.csv - NoTypeInformation - UseCulture
-
is it possible to find pages that are not my favorites?
is it possible to find pages that are not my favorites?
Yes, it can be done with a script that runs through the entire tree of bookmarks (this must be done recursively, assuming that there are several layers), runs the command associated with each bookmark and then collects the page numbers in a table. All of the pages in the table at the end of the process are not pointed to by any bookmark.
-
How to find computers that are not on the domain in an Active Directory forest.
Hello
I'm looking for a tool that can scan a subnet and give me the list of computers that are not on the field, but connected to the network. My company has recently spent a lot of users of the task force to the area, but there is a population of users who are unwilling to join the domain and still using the local administrator to log on to the computer.
These computers do not meet the domain policies applied and causing many problems with the network and other systems on the field.
Help, please.
concerning
Syed M. Uzair
This issue is beyond the scope of this site and must be placed on Technet or MSDN -
WebHelp, view a topic that is not present in the table of contents
Hello
I'm working on RH8. I use multiple TOC and created a table of contents with only the first 4 chapters. After having generated the WebHelp by using that FAKE, even if I look for a subject that did not exist in the table of contents, I can see the help.
Ideally, if the topic is not added to the table of contents, should not be displayed even if someone searches for it.
Please help me with this.
Looks like you expect the table of contents to control what is in the construction and it's not the way it works. It is simply the pointer on key issues, which may need to support the topics where you wouldn't wish that the user to start and that might clutter up the table of contents.
What you see, it's the way it is supposed to work and how a HAT I've seen. The table of contents indicates what you want to highlight, the search finds all that is in the build.
You can use exclude research in properties, introduced in RH8. In this way the subject is in the build-up but not searchable.
If you don't want certain topics, use TCC to exclude.
See www.grainge.org for creating tips and RoboHelp
-
Generate data that are not available in the table
I have a table that has monthly data for agents. Example of table structure is the following:
create table agt_dum)
agent_id number,
number of months,
Commission number)
Examples of data include:
AGENT_ID MONTHS COUNCIL
1 1 50 1 2 100 1 6 25 2 1 10 2 2 20 Month value can be from 1 to 12.
So as you can see these data is missing for the agents a few months.
Here, the requirement is I need to generate data for each agent for 12 months. If the data is not already in the table and are should include agent_id, month number and commission is equal to zero.
The output for the above data would be:
AGENT_ID MONTHS COUNCIL
1 1 50 1 2 100 1 3 0 1 4 0 1 5 0 1 6 25 1 7 0 1 8 0 1 9 0 1 10 0 1 11 0 1 12 0 2 1 10 2 2 20 2 3 0 2 4 0 2 5 0 2 6 0 2 7 0 2 8 0 2 9 0 2 10 0 2 11 0 2 12 0 I tried SQL query with full outer join. I was able to generate data for columns of MONTHS and the COMMISSION using the NVL function. But I have been unable to generate the AGENT_ID.
Please share your suggestions.
I'm using Oracle 11 g 2.
Thank you
Sudhanshu
If you need something like:
WITH agt_dum (agent_id, MONTH, commission)
(SELECT 1, 1, 50 IN all double union)
Select 1, 2, 100 of all the double union
Select 1, 6, 25 Union double all the
Select double union all 2, 1, 10
SELECT 2, 2, 20 DOUBLES)
all_months as (select rownum as LUN double connect by rownum<=>=>
SELECT *.
To all_months:
partition outer join agt_dum ad bequeathed (agent_id) on (ad.month = am.mon)
/
It is not yet complete, but I'm sure you can handle the rest...
HTH
-
Need to create a trigger that generates multiple rows in another table
{size: 12} Hello
I use Oracle9i (9.2.0.4.0)
My problem is:
I need to create a trigger that create different in the other table lines when someone will introduce a new line in the first table.
For this, I use the table 4:
1. first one where you want the trigger.
2. a second just to take information.
3. a third to make a trip meter.
4. the fourth is the table where I want to create new lines. {size}
Here is a summary of these 4 tables:
{color: blue} Table 1
STOJOU
Number ¿Nulo? Tipo
STOFCY_0 NOT NULL VARCHAR2 (9)
ITMREF_0 NOT NULL VARCHAR2 (60)
LOT_0 NOT NULL VARCHAR2 (45)
VCRTYP_0 NOT NULL NUMBER (3)
VCRNUM_0 NOT NULL VARCHAR2 (45)
VCRLIN_0 NOT NULL NUMBER (10)
QTYSTU_0 NOT NULL NUMBER
NUMVCR_0 NOT NULL VARCHAR2 (45) {color}
{color: blue} Table 2
ITMMASTER
Number ¿Nulo? Tipo
ITMREF_0 NOT NULL VARCHAR2 (60)
ZCOEFI_0 NOT NULL NUMBER {color}
{color: blue} Table 3
ZCTUART;
Number ¿Nulo? Tipo
CTUART_0 NOT NULL NUMBER (10)
CTUDATE_0 NON NULL DATE {color}
{color: blue} Table 4
ZUART
Number ¿Nulo? Tipo
ZUARTDM_0 NOT NULL VARCHAR2 (102)
STOFCY_0 NOT NULL VARCHAR2 (9)
STOCOU_0 NOT NULL NUMBER
ITMREF_0 NOT NULL VARCHAR2 (60)
LOT_0 NOT NULL VARCHAR2 (45)
CREDAT_0 NOT NULL DATE
QTYSTU_0 NOT NULL NUMBER
STA_0 NOT NULL VARCHAR2 (3)
VCRLIN_0 NOT NULL NUMBER (10)
VCRNUM_0 NOT NULL VARCHAR2 (45)
VCRTYP_0 NOT NULL NUMBER (3) {color}
I do this trigger:
{size: 12} And the error message I get States is just:CREATE OR REPLACE TRIGGER CREA_REGISTROS_TRAZA AFTER INSERT ON STOJOU FOR EACH ROW DECLARE n INTEGER; ct NUMBER; fecha_actual VARCHAR2; fecha_old VARCHAR2; codigo_dm VARCHAR2; BEGIN fecha_actual := TO_CHAR(SYSDATE, 'DD/MM/YYYY'); -- SELECT TO_CHAR(sysdate, 'DD/MM/YYYY') INTO fecha_actual FROM DUAL; SELECT TRUNC((STOJOU.QTYSTU_0/ITMMASTER.ZCOEFI_0),0) INTO n FROM STOJOU INNER JOIN ITMMASTER ON STOJOU.ITMREF = ITMMASTER.ITMREF; FOR i IN 1 .. n LOOP SELECT CTUART_0,TO_CHAR(CTUDAT_0, 'DD/MM/YYYY') INTO ct,fecha_old FROM ZCTUART; IF fecha_old <> fecha_actual THEN ct := 0; END IF; ct := ct + 1; INSERT INTO ZCTUART (CTUART_0,CTUDAT_0) VALUES (ct,SYSDATE); codigo_dm := SUBSTR('000000000000000000000',1,20 - LENGHT(NEW.ITMREF_0)) || NEW.ITMREF_0 || SUBSTR('0000000000',1,10 - LENGHT(NEW.LOT)) || NEW.LOT || SUBSTR('0000',1,4 - LENGHT(ct)) || ct; INSERT INTO ZUART (ZUARTDM_0,ITMREF_0,CREDAT_0,STA_0,QTYSTU_0,LOT_0,STOFCY_0,VCRLIN_0,VCRNUM_0,VCRTYP_0) VALUES (codigo_dm,NEW.ITMREF_0,SYSDATE,0,NEW.QTYSTU_0,NEW.LOT_0,NEW.STOFCY_0,NEW.VCRLIN_0,NEW.VCRNUM_0,NEW.VCRTYP_0); END LOOP; END CREA_REGISTROS_TRAZA; /
"The trigger was created with compilation errors."
Thanks for the help {size}You must prefix your NEW "columns" with a colon, as in: NEW.
-
What is your strategy to find errors that are not triggered by the WebService error handler?
Is there a way to underride the default functionality of WebService.as? I can't find the source code in the SDK, so I guess that this part of Flex is not Open Source.
I find that the use of Web services there are many errors that potentially happen that I can't capture in the user interface. Alternatively, let me rephrase, I couldn't find a way to capture in the user interface.
For example, the error message "Unable to load the WSDL" following occurs. Now, I could probably design a strategy all about check that the connection is still alive and these, but then I saw the other errors that occur in the WebService base classes that are all asynchronous licensees.
Is it possible to add a default handler than capures these types of errors? (They aren't catches by FaultHandlers).
I can't have a user interface that displays the large white box to end-users with a stack trace. Thank you.
[FaultString = "Unable to load the WSDL" RPC error faultCode = "Server.NoServicesInWSDL" faultDetail = "no < wsdl:service > element in WSDL to." "]
to mx.rpc.wsdl::WSDL/getService() [E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc \wsdl\WSDL.as:256]
to mx.rpc.wsdl::WSDL/getPort() [E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\ws dl\WSDL.as:182]
to mx.rpc.soap::WebService/ http://www.adobe.com/2006/flex/mx/internal:wsdlHandler () [E:\dev\flex_3_beta3\sdk\framewor ks\projects\rpc\src\mx\rpc\soap\WebService.as:267 ]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
to mx.rpc.wsdl::WSDLLoader/checkLoadsOutstanding() [E:\dev\flex_3_beta3\sdk\frameworks\projec ts\rpc\src\mx\rpc\wsdl\WSDLLoader.as:195]
to mx.rpc.wsdl::WSDLLoader/resultHandler() [E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\s rc\mx\rpc\wsdl\WSDLLoader.as:173]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
to mx.rpc::AbstractInvoker / http://www.adobe.com/2006/flex/mx/internal:dispatchRpcEvent () [E:\dev\flex_3_beta3\sdk\fra meworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:175 ]
to mx.rpc::AbstractInvoker / http://www.adobe.com/2006/flex/mx/internal:resultHandler () [E:\dev\flex_3_beta3\sdk\framew orks\projects\rpc\src\mx\rpc\AbstractInvoker.as:198 ]
at mx.rpc::Responder/result() [E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx\rpc\Res ponder.as:48]
at mx.rpc::AsyncRequest/acknowledge() [E:\dev\flex_3_beta3\sdk\frameworks\projects\rpc\src\mx \rpc\AsyncRequest.as:81]
to DirectHTTPMessageResponder / completeHandler ([E:\dev\flex_3_beta3\sdk\frameworks\projects\ rpc\src\mx\messaging\channels\DirectHTTPChannel.as:387])
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
I discovered the programmers, that when I do not use the debug version of the player that those mistakes should properly propagate to the error handler.
-
ORDER BY using for the column that is not in a select list of selection?
Hi all.
I have a selection list on an APEX at the apex.oracle.com page, and I would like to order by the value of the UnitOrder column.
The SQL is:
Of course, this code does not work. And since it's a selection list, I can't just add foodunit.unitorder to the SELECT statement. In addition, I can not get rid of the SEPARATE, because then for some reason, it tends to view an infinite amount of the same line...SELECT DISTINCT foodunit.name AS display_value, foodunit.foodunitid AS return_value FROM foodunit, food WHERE foodunit.foodid = :P18_FOODID ORDER BY foodunit.unitorder ASC;
Order by UnitOrder is that all units that start with gram, mg, ml, kg,... etc., will be shown on top of the selection list. All other units of food will be shown on the second place and so on.
The UnitOrder column contains 1 or 2 as the value. 1 is the value for all lines which should be displayed at the top of the list of selection, 2 is the value for the rest.
So, what I want, it's all the lines in which the UnitOrder is 1, are displayed on top of the selection list. Usually only 2 list items get displayed in the list of selection at a time, depending on what food item a user has selected. The selection list is then refined to certain lines that match the foodid etc etc...
If someone has an idea, I would be very happy to hear about it.I don't see a join between the tables of your foodunit and food. That would solve your problem of "endless amount"?
(you can omit the food table of your selection)
-
Find items, that those containing 'insert into a table.
Hi, I have a table, say T, and I want to know what object in my database insert record in table T. What is SQL? TX in advance.Maybe something like
with x as (select ' /* comment */ insert ' || chr(13) || ' /*+ APPEND */ into ' || chr(13) || 't values(' text from dual union select ' /* comment */ insert ' || chr(13) || ' /*+ APPEND */ into ' || chr(13) || 'table1 values(' text from dual) select * from x where regexp_like (text, '^.*insert.*into.*t\W', 'cn');
that also avoids picking up 'insert into table1. I ' ts not perfect but should work in most cases. I would be interested
see if someone can come with a relentless example that would always pick up the required
string and never pick up a false positive.Of course, I forget what user_source distinguish the source lines in any case - scrub as well as.
Published by: Paul Horth on February 23, 2012 00:55
-
Update trigger that inserts the record in another table
I searched the forum and the web for an example like this and I can not find a:
A field is updated in the TABLE_A and it triggers a single record TABLE_B insert that has the old and the new value of the field.
I write a lot of complex data warehouse SQL-based reports, but very rarely do much PL/SQL, any help would be appreciated.
Thanks in advance.Hello
You can specify that the trigger should fire only when certain columns are referenced, like this:
create or replace trigger test_fund_trig before update OF FUNDING on table_a ...
If you do this, the trigger will not draw on statements such as:
UPDATE table_a SET mod_date = SYSDATE;
You should always use an IF statement, as I mentioned earlier, if you do not want to follow the updates where the value of this column has not really changed.
Maybe you are looking for
-
How to save a system recovery file and save to a flash drive?
I wish I had a system externally saved saved on my flash drive recovery disk. Does anyone know how to do this? I already did system restore on my computer. Thank you.
-
How can I find out what my password forgotten directors?
Hi I have a little problem, on the lower right of my netbook, solve pc issues icon told me to find an antivirus program-IMPORTANT! I went to the microsoft site, to get their download free security (which is fantastic!) and I am unable to download wit
-
Photosmart 475 ink HP 100 gray
Hi all I want to print some pictures black and white on my printer with the HP 100 grey cartridge 475, but before I go and buy the cartridge does anyone have experience using it? Do I need my photo in black and white/black and white, print in black a
-
Windows Vista Edition Home Premium. Acer laptop. Windows Defender was already on the computer. Installed Security Essentials and it automatically disabled Defender. Problem: I need Windows Defender to manage start-up and turn programs programs (I don
-
Windows media center Vista - failure of a component of recording units
Hi I had a problkems with windows media center. When I try to start, the following message appears "component registration failure. I looked at the form post Jan last year. There is a solution that has worked for the same problem?