[Show all top banners]

micky_micky
Replies to this thread:

More by micky_micky
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 I just need a Query!! For SQL janne Maanche!! VERY IMP
[VIEWED 6195 TIMES]
SAVE! for ease of future access.
Posted on 08-13-09 3:09 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

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

 
Posted on 08-13-09 3:18 PM     Reply [Subscribe]
Login in to Rate this Post:     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

 
Posted on 08-13-09 3:27 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Alias issue. Make sure to use alias for each column name in the select list.
 
Posted on 08-13-09 4:05 PM     Reply [Subscribe]
Login in to Rate this Post:     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


 
Posted on 08-13-09 4:11 PM     Reply [Subscribe]
Login in to Rate this Post:     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 be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 200 days
Recommended Popular Threads Controvertial Threads
ChatSansar.com Naya Nepal Chat
TPS Re-registration case still pending ..
Toilet paper or water?
Anybody gotten the TPS EAD extension alert notice (i797) thing? online or via post?
ढ्याउ गर्दा दसैँको खसी गनाउच
Sajha Poll: Who is your favorite Nepali actress?
Problems of Nepalese students in US
nrn citizenship
TPS EAD auto extended to June 2025 or just TPS?
whats wrong living with your parents ?
Mamta kafle bhatt is still missing
Ajay Kumar Dev sentenced to 378 yrs
Why Americans reverse park?
Now Trump is a convicted criminal .
TPS advance parole Travel document i-131, Class of Admission ?
Tourist Visa - Seeking Suggestions and Guidance
Nepali Passport Renewal
मन भित्र को पत्रै पत्र!
Biden said he will issue new Employment visa for someone with college degree and job offers
To Sajha admin
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters