locked
connect two table in sql join RRS feed

  • Question

  • User670138138 posted

    Hi,

    How to combine two table and bring column of both table in a single select statement. 

    For e.g, I have employee and qualification table

    In Employee (<g class="gr_ gr_365 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="365" data-gr-id="365">empid</g>, <g class="gr_ gr_366 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="366" data-gr-id="366">empname</g><g class="gr_ gr_369 gr-alert gr_gramm gr_inline_cards gr_run_anim Style replaceWithoutSep" id="369" data-gr-id="369">,salary</g>)

    In Qualification (id, qualification, <g class="gr_ gr_367 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="367" data-gr-id="367">empid</g>) 

    I want to show all <g class="gr_ gr_397 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="397" data-gr-id="397">empname</g>, salary, qualification in <g class="gr_ gr_514 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" id="514" data-gr-id="514">single</g> select statement.

    how to join this table

    Thanks

    Regards

    <g class="gr_ gr_570 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace gr-progress" id="570" data-gr-id="570">Labnal</g>

    Monday, October 15, 2018 5:33 PM

Answers

  • User-1058791792 posted

    Hi labnalstar,

    You can use inner join for your required output.

    like 

    Select emp.name,emp.salary,Q.qualification from employee emp
    inner join qualification  Q.empid=emp.empid

    you can refer inner join 

    https://www.w3schools.com/sql/sql_join_inner.asp/

    https://avtartime.com/sql-inner-join-with-examples/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 15, 2018 6:02 PM
  • User77042963 posted
    Select e.employeename,e.salary,q.qualification from employee e
    LEFT join qualification q on  q.empid=e.empid
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 15, 2018 6:09 PM

All replies

  • User-1058791792 posted

    Hi labnalstar,

    You can use inner join for your required output.

    like 

    Select emp.name,emp.salary,Q.qualification from employee emp
    inner join qualification  Q.empid=emp.empid

    you can refer inner join 

    https://www.w3schools.com/sql/sql_join_inner.asp/

    https://avtartime.com/sql-inner-join-with-examples/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 15, 2018 6:02 PM
  • User77042963 posted
    Select e.employeename,e.salary,q.qualification from employee e
    LEFT join qualification q on  q.empid=e.empid
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 15, 2018 6:09 PM