|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Retrieving Data from 3 or more tables
Dear Friends,
I have recently joined and I have registered to forums for the first time, please don't be offended if I haven't posted in a proper manner. I have a problem with my Oracle 9i SQL Query and I'm struggling to get it done. I have three tables namely Student, Lease and Room and want to retrieve data from these three tables. I want the Student name, the Lease details and the Room No from these tables. The problem with my SQL query is that I get all the information from the tables except from the Room table, where in the column it show Room_No but the values are not displayed, the query is given below. Any help given to this query whether it works or not will be appreciated. Code:
SELECT STUDENT.STU_FNAME, STUDENT.STU_LNAME, LEASE.LSE_NO, LEASE.LSE_DURATION, LEASE.LSE_STARTS, LEASE.LSE_ENDS, ROOM.ROOM_NO FROM STUDENT LEFT OUTER JOIN LEASE ON LEASE.STU_ID = STUDENT.STU_ID LEFT OUTER JOIN ROOM ON ROOM.PLACE_NO = LEASE.PLACE_NO; Thank You |
|
#2
|
|||
|
|||
|
Quote:
You can give this a try Code:
SELECT S.STU_FNAME, S.STU_LNAME, L.LSE_NO, L.LSE_DURATION, L.LSE_STARTS, L.LSE_ENDS, R.ROOM_NO FROM STUDENT S, LEASE L, ROOM R WHERE S.STU_ID = L.STU_ID AND L.PLACE_NO = R.PLACE_NO; |
|
#3
|
|||
|
|||
|
Doesn't Work
Quote:
I have tried this before but it displays now rows selected, I think there might be a problem with my table. Thank You for your help! |
|
#4
|
|||
|
|||
|
The code does work!!!
Thanks for your help, the code which you had send me did work, there was actually a spelling mistake in my table where the other table couldn't find a link with the primary key.
Once again thank you. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Retrieving Data from 3 or more tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|