I just need a Query!! For SQL janne Maanche!! VERY IMP - Sajha Mobile
SAJHA MOBILE
I just need a Query!! For SQL janne Maanche!! VERY IMP
Posts 5 · Viewed 5269 · Go to Last Post
micky_micky
· Snapshot
Like · Likedby · 0
zz
Last edited: 16-Aug-09 09:20 PM
perfectionist
· Snapshot
Like · Liked by · 0
define the table map for all selected parameters as well

in ur case,

SQL> select First_Name, Last_Name, Address, a.User_Name, Status, University
from User_Info a, Admission_Code b, Univ_Code c, User_Admission_Status
d where a.User_Name=d.User_Name and b.Code=d.Admission_Code and
c.Code=d.Univ_Code;
select First_Name, Last_Name, Address,
User_Name, Status, University from User_Info a, Admission_Code b,
Univ_Code c, User_Admission_Status d where a.User_Name=d.User_Name and
b.Code=d.Admission_Code and c.Code=d.Univ_Code

the error u got is becoz of there are columns in ur table that are present in both mapped tables

i dint go thru all columns but i think User_Admission_Status and User_Info have same named column, User_Name, thus the error.

best wud b to use tablename.columnName format

like

SELECT
table1.column1, table2.column1, table2.column3
FROM
tblFirst table1,
tblSecond table2

even better would be using Joins instead of commas.

i hope it helps
SickNTired
· Snapshot
Like · Liked by · 0
Alias issue. Make sure to use alias for each column name in the select list.
बैरे
· Snapshot
Like · Liked by · 0

select a.First_Name, a.Last_Name, a.Address, a.User_Name, c,Status, b.University from User_Info a, Admission_Code b, Univ_Code c, User_Admission_Status d where a.User_Name=d.User_Name and b.Code=d.Admission_Code and c.Code=d.Univ_Code;


I didn't try this but the logic sound right this way


Try This one

बैरे
· Snapshot
Like · Liked by · 0

Here this is what I have created and this should yield the right result


 


SQL> desc User_Info
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 FIRST_NAME                                NOT NULL VARCHAR2(30)
 LAST_NAME                                 NOT NULL VARCHAR2(30)
 ADDRESS                                   NOT NULL VARCHAR2(100)
 USER_NAME                                 NOT NULL VARCHAR2(20)
 PASSWORD                                  NOT NULL VARCHAR2(20)


SQL> desc Admission_Code
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 CODE                                      NOT NULL NUMBER(38)
 STATUS                                    NOT NULL VARCHAR2(20)


SQL> desc Univ_Code
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 CODE                                      NOT NULL NUMBER(38)
 UNIVERSITY                                NOT NULL VARCHAR2(30)


SQL> desc User_Admission_Status
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 USER_NAME                                 NOT NULL VARCHAR2(20)
 UNIV_CODE                                          NUMBER(38)
 ADMISSION_CODE                                     NUMBER(38)


SQL> select a.First_Name, a.Last_Name, a.Address, a.User_Name, b.Status, c.University from User_Info a, Admission_Code b, Univ_Code c, User_Admission_Status d where a.User_Name=d.User_Name and b.Code=d.Admission_Code and c.Code=d.Univ_Code;


no rows selected


Good Luck

Please log in to reply to this post

You can also log in using your Facebook
View in Desktop
What people are reading
You might like these other discussions...
· Posts 1 · Viewed 55
· Posts 1 · Viewed 54
· Posts 1 · Viewed 53
· Posts 4 · Viewed 305
· Posts 10 · Viewed 861 · Likes 1
· Posts 9 · Viewed 1296
· Posts 1 · Viewed 101
· Posts 1 · Viewed 108
· Posts 1 · Viewed 86
· Posts 12 · Viewed 662



Your Banner Here
Travel Partners
Travel House Nepal