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

Problem with Query

P: 39
I created 2 tables


DoctorRegistration2

Name varchar(50)
UserId1 varchar(50)
Password1 varchar(15)
Sex varchar(10)
Dob varchar(50)
EmailId varchar(50)

DoctorRegistration1

Country varchar(50)
State varchar(50)
City varchar(15)
Address varchar(200)
ContactNo varchar(50)
AreaOfSpecialization varchar(50)
Hospital varchar(50)
ConsultancyTiming varchar(50)
OnlineConsultancy varchar(15)
OnlineAppointment( varchar(10)




The thing is I have to select the Name from DoctorRegistration2 table based on AreaOfSpecialization & Country in DoctorRegistration1 table. For that I have given the query as

"select d.Name from DoctorRegistration2 d,DoctorRegistration1 d1 where d1.Country='" & Trim(ddlCountry.SelectedItem.Value()) & "'and d1.AreaOfSpecialization='" & Trim(DropDownList2.SelectedItem.Value()) & "'"

The problem is all names are getting displayed. How can I give the relation for both the tables & make it possible.
May 26 '08 #1
Share this Question
Share on Google+
2 Replies


debasisdas
Expert 5K+
P: 8,127
Is there ay relationship between these two tables ?
May 26 '08 #2

ck9663
Expert 2.5K+
P: 2,878
Looks like you split the table to make it relational. You might need to defined a PK on both table which you can use to JOIN the two.

-- CK
May 26 '08 #3

Post your reply

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