Home » SQL & PL/SQL » SQL & PL/SQL » SQL statement - think I need to use joins (oracle 10g / winxp)
SQL statement - think I need to use joins [message #360657] Fri, 21 November 2008 21:07 Go to next message
whitk
Messages: 1
Registered: November 2008
Junior Member
I believe I may need to use some inner / outter joins to accomplish this, but wanted to ask for some feedback.

I have 3 tables that I needing to pull some data out of. The primary key is Account_Num.

Table1 - Contains all the accounts that I need to pull a list from where tot_val > 750000

Table2 & Table3 - These contain various amounts of information for the accounts that I got from Table1. Some of the accounts from table1 may not contain values in table2 & table3. I need to pull the result set together, so I ultimately see something like:

account_num tot_val tax_amt owner_name owner_address num_rooms num_bathroom


Example of Tables:
--------------------------------------------
Table1 (T1)
account_num tot_val
---------------------------------------------
Table2 (T2)
account_num tax_amt owner_name owner_address
---------------------------------------------
Table3 (T3)
account_num num_rooms num_bathroom
---------------------------------------------


Thanks.
Re: SQL statement - think I need to use joins [message #360664 is a reply to message #360657] Sat, 22 November 2008 00:18 Go to previous message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes, you are right you need outer joins.

Please read OraFAQ Forum Guide.
Generally speaking, for SQL question you need to:
- post a test case: create table and insert statements along with the result you want for these data
- post what you already tried
- post this in a formatted way, see "How to format your post?" section
- post your Oracle version (with 4 decimals)

Regards
Michel
Previous Topic: SQL execution plan
Next Topic: How to lock rows fetched by inline view
Goto Forum:
  


Current Time: Sat Dec 10 22:31:30 CST 2016

Total time taken to generate the page: 0.16680 seconds