I just need a Query!! For SQL janne Maanche!! VERY IMP

Archived from the original Sajha.com — preserved as posted, replies can no longer be added here.
Start a New Discussion
Archived Post

zz Last edited: 16-Aug-09 09:20 PM

micky_micky · Aug 13, 2009 3:09 PM · 15,987 views

4 Replies

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

perfectionist · Aug 13, 2009 3:18 PM

Alias issue. Make sure to use alias for each column name in the select list.

SickNTired · Aug 13, 2009 3:27 PM

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

बैरे · Aug 13, 2009 4:05 PM

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

बैरे · Aug 13, 2009 4:11 PM

This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.

Start a New Discussion

You might be interested in...

Recent Classifieds View all
Upcoming Events View all
Service Providers View all