[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 5084 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 90 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
Basnet or Basnyat ??
TPS Re-registration case still pending ..
Sajha has turned into MAGATs nest
NRN card pros and cons?
Nas and The Bokas: Coming to a Night Club near you
Will MAGA really start shooting people?
मन भित्र को पत्रै पत्र!
Top 10 Anti-vaxxers Who Got Owned by COVID
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
TPS Work Permit/How long your took?
Breathe in. Breathe out.
3 most corrupt politicians in the world
Guess how many vaccines a one year old baby is given
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
चितवनको होस्टलमा १३ वर्षीया शालिन पोखरेल झुण्डिएको अवस्था - बलात्कार पछि हत्याको शंका - होस्टेलहरु असुरक्षित
शीर्षक जे पनि हुन सक्छ।
Disinformation for profit - scammers cash in on conspiracy theories
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