1747994 Members
4997 Online
108756 Solutions
New Discussion юеВ

Re: Help Required in Sql

 
Chitta
Frequent Advisor

Re: Help Required in Sql

Hi,
Now am getting confused,
both queries are giving diffrent results,
i dont know which one is correct.

please confirm,

Regs,
Chitta
TwoProc
Honored Contributor

Re: Help Required in Sql

this might run faster without indexes - give it a try ...

select doc_num,doc_type from
(( select doc_num,doc_type from tableA)
intersect
(select doc_num,doc_type from tableD))
minus
(select doc_num,doc_type from tableB)
minus
(select doc_num,doc_type from tableC)
;

Depending on what you want to do with some records in B, but not in C, or in C but not in B - you may have to play with parenthesis and grouping for the "minus" section. The above removes records from the result that are in either of B or C. Your question was not clear on that aspect, however if all of B and C were the same - then you'd just use one of the tables, you wouldn't need both. Therefore, I wrote the above with removing from the answer set anything in either B or C.
We are the people our parents warned us about --Jimmy Buffett
Chitta
Frequent Advisor

Re: Help Required in Sql

Hi,
Thanks for update,
my concern is not on performance related,

my requirement is, i want to select some data form table A and the condition is those data should not be in tbale B anc C, and should be in D.

like select a.no from a where a.no<>b.no AND a.no<>c.no AND a.no=d.no

it should be 'AND',

So i had couple of queries having same condition, but giving diffrent result(i.e, varies in total no.of rows)

since the volume of data is very hing (approx'ly, 1,000,000 on each table am b=not able to run the query handy.


please advise,
Regs,
Chitta.




Chitta
Frequent Advisor

Re: Help Required in Sql

Hi All,
thanks for support,
i had completed the task.

Regs,
Chitta
Yogeeraj_1
Honored Contributor

Re: Help Required in Sql

hi Chitta,

Glad to hear this from you.

Can you please let us know which solution you finally adopted?

also read:
http://forums11.itrc.hp.com/service/forums/helptips.do?#34

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)