Results 1 to 4 of 4

Thread: Selecting Data from Two Tables

  1. #1
    Junior Member
    Join Date
    Jun 2007
    Answers
    1

    Selecting Data from Two Tables

    I create two tables Ta1 and Ta2, from that I will select field where Student have same blood group like AB+.., In Ta1 two person have same AB+ and also Ta2 have two person have AB+ ,

    my Query is

    select ta1.Name,ta1.dept,ta2.nam,ta2.dep from ta1,ta2 where ta1.blo_g='AB+' and ta2.bl_g='AB+'

    but result is displaying second table (ta2's) result again


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Selecting Data from Two Tables

    In this scenario u need to Join both the tables based on some common field.
    It would be better if u can kindly post the structure of both the tables with there relations if any.


  3. #3
    Contributing Member
    Join Date
    Feb 2007
    Answers
    34

    Lightbulb Re: Selecting Data from Two Tables

    Hello Mohammed,
    You can use Equi join here. join table 1 and table 2 on blood group. hope this will work.


  4. #4
    Junior Member
    Join Date
    Jul 2007
    Answers
    5

    Re: Selecting Data from Two Tables

    Hi
    just try this select * from ta1 and ta2
    where ta1.blo_g='AB+' and ta2.bl_g='AB+'
    is it working?
    if not use joins.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact