Please help Urgent SQL query RRS feed

  • Question

  • User-327678527 posted

    I am using Access database Please help me in SQL query 

     have 2 tables like below:

    Tbl_Employee                                  Tbl_Destination

    ---------------                                   --------------------

    IdEmployee                                      Id_Destination

    Name                                               Destination_Name



    I need help to output like Below

    Emp_Name           Source                 Destination


    John Doo              Germany              Canada

    Tony Montana      Brazil                    Egypt

    Suzan Jimba          Norway                Sweeden

    Destination (Egpt,Brazil,Canada) are stored in Tbl_Destination in the field Destination_Name 

    I am using Access Database and asp.net


    Tuesday, September 29, 2020 9:54 AM

All replies

  • User269602965 posted

      a.NAME                    AS Emp_Name,
      a.Id_Trip_Source       AS Source,
      b.Destination_Name AS Destination
      Tbl_Employee a
    LEFT OUTER JOIN Tbl_Destination b ON a.Id_Trip_Destination = b.Id_Destination

    you do not specify of the SOURCE name is also stored in the destination table or in a separate "source" name table.

    You would have to add LEFT OUTER JOIN to support the lookup to the SOURCE name

    Friday, October 9, 2020 3:38 AM
  • User1535942433 posted

    Hi Samkoukou,

    Accroding to your description,could you tell us  what the relationship of two tables.

    As far as I think,you could join two tables.However,these two tables must have primary key , foreign key  and relationship.


    FROM table1 [ LEFT | RIGHT ] JOIN table2 ON table1.field1 compopr table2.field2

    More details,you could refer to below article:


    Best regards,

    Yijing Sun

    Tuesday, October 13, 2020 6:57 AM