Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 27th, 2004, 02:27 AM
SatSat SatSat is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 6 SatSat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Oracle join

Hi

I am working in Oracle 8i. I have two tables T1(C1,C2) and T2(C1,C3,C4) with T1.C1 = T2.C1. I need to find all C1's from T1 where T1.C1 = T2.C1 and T2.C3 contains a list of values. Is it possible to get it in single query?

Note: all the values in the list should be present in T2.C3

Regards
Sathish.B

Reply With Quote
  #2  
Old October 27th, 2004, 02:29 AM
SatSat SatSat is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 6 SatSat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sorry, its T2.C3

Quote:
Originally Posted by SatSat
Hi

I am working in Oracle 8i. I have two tables T1(C1,C2) and T2(C1,C3,C4) with T1.C1 = T2.C1. I need to find all C1's from T1 where T1.C1 = T2.C1 and T2.C2 contains a list of values. Is it possible to get it in single query?

Note: all the values in the list should be present in T2.C2

Regards
Sathish.B

Reply With Quote
  #3  
Old October 27th, 2004, 08:25 AM
jiggee jiggee is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 27 jiggee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 27 sec
Reputation Power: 0
select T1.C1 from T1, T2 where
T1.C1 = T2.C1 and
T2.C3 is not null

Reply With Quote
  #4  
Old October 28th, 2004, 12:40 AM
SatSat SatSat is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 6 SatSat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ur query will return whichever is not null. i want something like this...

select T1.C1 from T1,T2
where T1.C1=T2.C1
and T2.C3 in ('X','Y')

the value T1.C1 should have both X,Y mapped in T2.C1, but the query above gives T1.C1 even if it is mapped to either of X or Y.

Reply With Quote
  #5  
Old October 28th, 2004, 09:25 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 6
How do you store data into table?? could you please provide some data?

Reply With Quote
  #6  
Old October 28th, 2004, 11:19 PM
SatSat SatSat is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 6 SatSat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
If the table data is like this...
T1-----------T2
C1---C2------C1-------C3-------C4

1-----A-------1--------X-------ABC
2-----B-------1--------Y-------123
--------------1--------Z-------XYZ
--------------2--------X-------123

my join is T1.C1=T2.C1 and T2.C3 should contain both X and Y. so my output will be only "1". if i use T2.C3 in ('X','Y') I am getting both "1" and "2".

have used - instead of tab.

Reply With Quote
  #7  
Old October 29th, 2004, 04:31 AM
tsmetz tsmetz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 44 tsmetz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 25 m 22 sec
Reputation Power: 5
select T1.C1 from T1,T2 t21,T2 t22
where T1.C1=T21.C1
and T1.C1=T22.C1
and T21.C3 ='X'
and T22.C3 ='Y'

Reply With Quote
  #8  
Old November 1st, 2004, 05:50 AM
SatSat SatSat is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 6 SatSat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the query, but if I need to check 10 values(X,Y,A,B,C,Z,.....), then should I have to implement 10 joins? if I do so, will it not shoot the server performance?

Regards
Sathish.B

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Oracle join


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT