Home » Developer & Programmer » Forms » how to join more than three tables (oracle 9i)
how to join more than three tables [message #306395] Fri, 14 March 2008 01:12 Go to next message
mandygrewalindia
Messages: 14
Registered: February 2008
Location: india
Junior Member
hi...
i have three tables..
desc hotel_details;
Name Null? Type
---------------------------------------------------------------------------------------------------
HOTEL_SRNO NOT NULL VARCHAR2(10)
PLACE_NAME NOT NULL VARCHAR2(25)
HOTEL_NAME NOT NULL VARCHAR2(25)
and annother two tables
with same attributes and datatypes
SQL> desc one_night;
Name Null? Type
---------------------------------------------------------------------------------------------------
NO_OF_NIGHTS NOT NULL VARCHAR2(10)
HOTEL_SRNO VARCHAR2(10)
ROOM_TYPE NOT NULL VARCHAR2(25)
COUPLE_CHARGE NOT NULL NUMBER(10)
EXPERSON_CHARGE NOT NULL NUMBER(10)
CHILD_CHARGE NOT NULL NUMBER(10)
primary ey is applies on hotel_sr of hole_details
and foreign key is applied on hotel_sr column ofother two tables
one_night and two_night.
i need to dispay data of three tables together
please suggest.


Re: how to join more than three tables [message #306408 is a reply to message #306395] Fri, 14 March 2008 02:15 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Do you know how do you join two tables? I guess you do.

The same way you'd join three, four or as many tables as you need. Just make sure all columns are properly joined. Also, if column names are the same, you'll need to prefix their name with table names (or aliases) in order to avoid "column ambiguously defined" error.
Re: how to join more than three tables [message #306411 is a reply to message #306395] Fri, 14 March 2008 02:22 Go to previous message
flyboy
Messages: 1903
Registered: November 2006
Senior Member
Yes, you shall use join. Examples are here. If you are on 9i or later, use preferably join clause instead of join condition in the where clause

Choose between INNER and OUTER JOIN according to the requirements (shall you display HOTEL_DETAILS row when no corresponding row in ONE_NIGHT and/or TWO_NIGHT is present?).
Previous Topic: Copy values from header to line in multiblock records
Next Topic: Export data from Excel to form Builder and vice versa
Goto Forum:
  


Current Time: Sun Feb 09 04:35:28 CST 2025