Unix Technical Forum

sql query

This is a discussion on sql query within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I'm beginer, plase help me I have on my oracle 9 server, table like this: G | K | ...


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

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-07-2008, 09:58 PM
Mariusz Stefaniak
 
Posts: n/a
Default sql query

I'm beginer, plase help me

I have on my oracle 9 server, table like this:

G | K | Wartosc
---------------------------------
A | 1 | 0
A | 2 | 1
A | 3 | 1
A | 4 | 0
B | 1 | 1
B | 2 | 0
B | 3 | 0
B | 4 | 0
B | 5 | 1

I'd like to get data presentation like this:
G | K | Wartosc | G | K | Wartosc |
----------------------------------------------------------
A | 1 | 0 | B | 1 | 1 |
A | 2 | 1 | B | 2 | 0 |
A | 3 | 1 | B | 3 | 0 |
A | 4 | 0 | B | 4 | 0 |
| B | 5 | 1
|


Plase, help me make sql query


Thank you very much
Mariusz




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-07-2008, 09:58 PM
Michel Cadot
 
Posts: n/a
Default Re: sql query


"Mariusz Stefaniak" <mariusz@stefaniak.cjb.net> a écrit dans le message de
news:ce5a8s$lva$1@achot.icm.edu.pl...
> I'm beginer, plase help me
>
> I have on my oracle 9 server, table like this:
>
> G | K | Wartosc
> ---------------------------------
> A | 1 | 0
> A | 2 | 1
> A | 3 | 1
> A | 4 | 0
> B | 1 | 1
> B | 2 | 0
> B | 3 | 0
> B | 4 | 0
> B | 5 | 1
>
> I'd like to get data presentation like this:
> G | K | Wartosc | G | K | Wartosc |
> ----------------------------------------------------------
> A | 1 | 0 | B | 1 | 1 |
> A | 2 | 1 | B | 2 | 0 |
> A | 3 | 1 | B | 3 | 0 |
> A | 4 | 0 | B | 4 | 0 |
> | B | 5 | 1
> |
>
>
> Plase, help me make sql query
>
>
> Thank you very much
> Mariusz
>


select a.g, a.k, a.wartosc, b.g, b.k, b.wartosc
from mytable a full outer join mytable b on a.k = b.k
where a.g = 'A' and b.g = 'B'
/

--
Regards
Michel Cadot


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-07-2008, 09:58 PM
Ed prochak
 
Posts: n/a
Default Re: sql query

"Mariusz Stefaniak" <mariusz@stefaniak.cjb.net> wrote in message news:<ce5a8s$lva$1@achot.icm.edu.pl>...
> I'm beginer, plase help me
>
> I have on my oracle 9 server, table like this:
>
> G | K | Wartosc
> ---------------------------------
> A | 1 | 0
> A | 2 | 1
> A | 3 | 1
> A | 4 | 0
> B | 1 | 1
> B | 2 | 0
> B | 3 | 0
> B | 4 | 0
> B | 5 | 1
>
> I'd like to get data presentation like this:
> G | K | Wartosc | G | K | Wartosc |
> ----------------------------------------------------------
> A | 1 | 0 | B | 1 | 1 |
> A | 2 | 1 | B | 2 | 0 |
> A | 3 | 1 | B | 3 | 0 |
> A | 4 | 0 | B | 4 | 0 |
> | B | 5 | 1
> |
>
>
> Plase, help me make sql query
>
>
> Thank you very much
> Mariusz


What class are you taking? Have you TRIED writing anything? (even the
query that gave the "table like this" result would show you started.)

But here's the hint: In a relational DB, everything is a table. Tables
can be joined to each other. Tables can even be joined to themselves.

Let us know how you do.
Ed
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-07-2008, 09:58 PM
Mariusz Stefaniak
 
Posts: n/a
Default Re: sql query

>
> select a.g, a.k, a.wartosc, b.g, b.k, b.wartosc
> from mytable a full outer join mytable b on a.k = b.k
> where a.g = 'A' and b.g = 'B'
> /
>
> --
> Regards
> Michel Cadot
>
>


It's working. Thank you!
Mariusz Stefaniak


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 02:36 AM.


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