Problem with Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suganya
    New Member
    • Dec 2006
    • 39

    Problem with Query

    I created 2 tables


    DoctorRegistrat ion2

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

    DoctorRegistrat ion1

    Country varchar(50)
    State varchar(50)
    City varchar(15)
    Address varchar(200)
    ContactNo varchar(50)
    AreaOfSpecializ ation varchar(50)
    Hospital varchar(50)
    ConsultancyTimi ng varchar(50)
    OnlineConsultan cy varchar(15)
    OnlineAppointme nt( varchar(10)




    The thing is I have to select the Name from DoctorRegistrat ion2 table based on AreaOfSpecializ ation & Country in DoctorRegistrat ion1 table. For that I have given the query as

    "select d.Name from DoctorRegistrat ion2 d,DoctorRegistr ation1 d1 where d1.Country='" & Trim(ddlCountry .SelectedItem.V alue()) & "'and d1.AreaOfSpecia lization='" & Trim(DropDownLi st2.SelectedIte m.Value()) & "'"

    The problem is all names are getting displayed. How can I give the relation for both the tables & make it possible.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Is there ay relationship between these two tables ?

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      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

      Comment

      Working...