Unix Technical Forum

New to Oracle

This is a discussion on New to Oracle within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hello! Wondering if someone can help educate me on the design on query that i would like to run. ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 08:23 AM
inlove22@hotmail.com
 
Posts: n/a
Default New to Oracle

Hello! Wondering if someone can help educate me on the design on query
that i would like to run.

Table A Table B
ID PAR_ID
X_ROW_1 X_ROW_3
.. ..
.. ..

Table A and B are linked by the ID and PAR_ID columns. So i need a
select statement that queries for all records that contain the non null
values of x_row_3 along with all the non_null values of x_row_1.
Sort of something like this. I know its some type of join but i can
get it to work.

x_row_1 x_row_3
2343 234523
234324
5645
979779

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 08:23 AM
Jim Kennedy
 
Posts: n/a
Default Re: New to Oracle


<inlove22@hotmail.com> wrote in message
news:1135216259.818266.149110@g43g2000cwa.googlegr oups.com...
> Hello! Wondering if someone can help educate me on the design on query
> that i would like to run.
>
> Table A Table B
> ID PAR_ID
> X_ROW_1 X_ROW_3
> .. ..
> .. ..
>
> Table A and B are linked by the ID and PAR_ID columns. So i need a
> select statement that queries for all records that contain the non null
> values of x_row_3 along with all the non_null values of x_row_1.
> Sort of something like this. I know its some type of join but i can
> get it to work.
>
> x_row_1 x_row_3
> 2343 234523
> 234324
> 5645
> 979779
>


select a.x_row_1,b.x_row_3 from table_a a, table_b b where a.id=b.par_id and
a.x_row_1 is not null and b.x_row_3 is not null

Jim


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 08:24 AM
Steven Kondolf
 
Posts: n/a
Default Re: New to Oracle

On Wed, 21 Dec 2005 21:13:32 -0800, "Jim Kennedy"
<kennedy-downwithspammersfamily@attbi.net> wrote:

>
><inlove22@hotmail.com> wrote in message
>news:1135216259.818266.149110@g43g2000cwa.googleg roups.com...
>> Hello! Wondering if someone can help educate me on the design on query
>> that i would like to run.
>>
>> Table A Table B
>> ID PAR_ID
>> X_ROW_1 X_ROW_3
>> .. ..
>> .. ..
>>
>> Table A and B are linked by the ID and PAR_ID columns. So i need a
>> select statement that queries for all records that contain the non null
>> values of x_row_3 along with all the non_null values of x_row_1.
>> Sort of something like this. I know its some type of join but i can
>> get it to work.
>>
>> x_row_1 x_row_3
>> 2343 234523
>> 234324
>> 5645
>> 979779
>>

>
>select a.x_row_1,b.x_row_3 from table_a a, table_b b where a.id=b.par_id and
>a.x_row_1 is not null and b.x_row_3 is not null
>
>Jim
>

I think you have to change the 'and' to 'or' in the select. If you
don't, you'll only get one row returned.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 08:25 AM
Mike Enarson
 
Posts: n/a
Default Re: New to Oracle


"Steven Kondolf" <skondolf@nospam.rochester.rr.com> wrote in message
news:cb3oq1pmpi0b10a844v4g5eeg425n899ir@4ax.com...
> On Wed, 21 Dec 2005 21:13:32 -0800, "Jim Kennedy"
> <kennedy-downwithspammersfamily@attbi.net> wrote:
>
>>
>><inlove22@hotmail.com> wrote in message
>>news:1135216259.818266.149110@g43g2000cwa.google groups.com...
>>> Hello! Wondering if someone can help educate me on the design on query
>>> that i would like to run.
>>>
>>> Table A Table B
>>> ID PAR_ID
>>> X_ROW_1 X_ROW_3
>>> .. ..
>>> .. ..
>>>
>>> Table A and B are linked by the ID and PAR_ID columns. So i need a
>>> select statement that queries for all records that contain the non null
>>> values of x_row_3 along with all the non_null values of x_row_1.
>>> Sort of something like this. I know its some type of join but i can
>>> get it to work.
>>>
>>> x_row_1 x_row_3
>>> 2343 234523
>>> 234324
>>> 5645
>>> 979779
>>>

>>
>>select a.x_row_1,b.x_row_3 from table_a a, table_b b where a.id=b.par_id
>>and
>>a.x_row_1 is not null and b.x_row_3 is not null
>>
>>Jim
>>

> I think you have to change the 'and' to 'or' in the select. If you
> don't, you'll only get one row returned.


It looks to me like you need to go with an outer join, instead of an inner
join.
It seems you are looking for all of the non null values from both columns.

Regards
Mike Enarson


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:25 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com