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 6241 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 365 days
Recommended Popular Threads Controvertial Threads
शीर्षक जे पनि हुन सक्छ।
NRN card pros and cons?
TPS Re-registration case still pending ..
What are your first memories of when Nepal Television Began?
Anybody gotten the TPS EAD extension alert notice (i797) thing? online or via post?
TPS Re-registration
Democrats are so sure Trump will win
Basnet or Basnyat ??
TPS EAD auto extended to June 2025 or just TPS?
nrn citizenship
Toilet paper or water?
Sajha has turned into MAGATs nest
Nas and The Bokas: Coming to a Night Club near you
Mamta kafle bhatt is still missing
ढ्याउ गर्दा दसैँको खसी गनाउच
ChatSansar.com Naya Nepal Chat
whats wrong living with your parents ?
डीभी परेन भने खुसि हुनु होस् ! अमेरिकामाधेरै का श्रीमती अर्कैसँग पोइला गएका छन् !
3 most corrupt politicians in the world
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
Nas and The Bokas: Coming to a Night Club near you
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