Home » SQL & PL/SQL » SQL & PL/SQL » SQL Query (Oracle 10 g R2 ,Unix)
SQL Query [message #392396] Tue, 17 March 2009 15:45 Go to next message
nghorakavi
Messages: 4
Registered: February 2008
Junior Member
HI
I have three tables

Division ( DIV_CD, DIV_Description)
Location (LOC_CD, Loc_Name)
GLCode ( GLAccount_Cd,GLAcct_name)

Can you help me in getting the query for this reqmt.

For each Division and LOcation code, I need to map all the GLCodes
for e.g. in Division i have Audio, in Location Sea, Seattle

for Audio and Seattle, I need to get all the GL Accountcodes.

What would be the SQL Query

Thanks,
Narsi.
Re: SQL Query [message #392404 is a reply to message #392396] Tue, 17 March 2009 16:18 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What did you manage to write so far?
Re: SQL Query [message #392405 is a reply to message #392404] Tue, 17 March 2009 16:24 Go to previous messageGo to next message
nghorakavi
Messages: 4
Registered: February 2008
Junior Member
I am thinking of putting Cross join Division and Location the result is again cross join with GL table. Does it give for each division and location all the GL Accounts mapped

Thanks in advance.
Re: SQL Query [message #392406 is a reply to message #392405] Tue, 17 March 2009 16:25 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Perhaps you should make your dreams true (i.e. don't just think, WRITE that query, run it and see what happens!).
Re: SQL Query [message #392407 is a reply to message #392406] Tue, 17 March 2009 16:31 Go to previous messageGo to next message
nghorakavi
Messages: 4
Registered: February 2008
Junior Member
currently i have asked to design and need to know that this will work or not. Appreciate any other solution.

thanks,
Narsi.
Re: SQL Query [message #392410 is a reply to message #392396] Tue, 17 March 2009 16:54 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/

I do NOT see any "common" fields that can be used to join the tables.


I suggest to read & study Third Normal Form & (re)design your application tables.

[Updated on: Tue, 17 March 2009 16:55]

Report message to a moderator

Previous Topic: Sorting Problem while generating table dynamically ?
Next Topic: Multiple Cursors
Goto Forum:
  


Current Time: Tue Dec 03 08:48:06 CST 2024