By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,364 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,364 IT Pros & Developers. It's quick & easy.

Retrieve data from Three table using JOIN

P: 40
create table stuinfo(roll int,name varchar(10))
insert into stuinfo values(1,'sonia')
insert into stuinfo values(2,'usha')
select * from stuinfo

create table marks(roll int,grade varchar)
insert into marks values(1,'A')
insert into marks values(2,'B')
select * from marks

create table fees(roll int,totfess int,remfess int)
insert into fees values(1,5000,1000)
insert into fees values(3,5000,0)
select * from fees

select stuinfo.roll,name,grade,tofees
from stuinfo
JOIN marks On stuinfo.roll=marks.roll
JOIN fees on marks.roll=fees.roll

error-Invalid Column totfees
Mar 30 '08 #1
Share this Question
Share on Google+
4 Replies


ck9663
Expert 2.5K+
P: 2,878
create table stuinfo(roll int,name varchar(10))
insert into stuinfo values(1,'sonia')
insert into stuinfo values(2,'usha')
select * from stuinfo

create table marks(roll int,grade varchar)
insert into marks values(1,'A')
insert into marks values(2,'B')
select * from marks

create table fees(roll int,totfess int,remfess int)
insert into fees values(1,5000,1000)
insert into fees values(3,5000,0)
select * from fees

select stuinfo.roll,name,grade,tofees
from stuinfo
JOIN marks On stuinfo.roll=marks.roll
JOIN fees on marks.roll=fees.roll

error-Invalid Column totfees

Your create table says

create table fees(roll int,totfess int,remfess int)

Your query says
select stuinfo.roll,name,grade,tofees

-- CK
Mar 30 '08 #2

P: 40
Thx Yaar. Sory, Its by mistake tofees.
Mar 30 '08 #3

ck9663
Expert 2.5K+
P: 2,878
So do you still have that error?

-- CK
Mar 31 '08 #4

P: 40
No yaar, its working
Mar 31 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.