Hi
I have data like below
Code
Code Emp1 Emp2 Emp3
1677 S-EMPL-0021
1494 S-EMPL-0218 S-EMPL-0218I want to displat data of Code field from 1 table say master
Emp1,Emp2,Emp3 data from another table say Trans
Thanks
Hi
I have data like below
Code Emp1 Emp2 Emp3
1677 S-EMPL-0021
1494 S-EMPL-0218 S-EMPL-0218I want to displat data of Code field from 1 table say master
Emp1,Emp2,Emp3 data from another table say Trans
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Eliana BlakeRank #1,595 · 993 reputationPosted Apr 5, 2025, 1:24 AM EDT
Hi there! To display the data as described using SQL queries, you can achieve this by performing a JOIN between the "master" and "Trans" tables based on the Code field. Here's an example SQL query for your scenario:
SELECT master.Code, Trans.Emp1, Trans.Emp2, Trans.Emp3 FROM master JOIN Trans ON master.Code = Trans.Code;In this query:
- We are selecting the Code field from the "master" table and the Emp1, Emp2, and Emp3 fields from the "Trans" table.
- By using JOIN and specifying the condition `master.Code = Trans.Code`, we are linking the two tables based on the common field "Code".
When you execute this query, it will fetch data from the specified fields in both tables where the Code values match.
If you have actual table names and column names, make sure to replace "master" and "Trans" with your actual table names and adjust the column names accordingly.
I hope this helps! If you have any more questions or need further clarification, feel free to ask.
Rikam PalkarRank #52 · 30.2K reputationPosted Apr 5, 2025, 2:13 PM EDT
you'll need to join the two tables using a common field
Code.try this:
SELECT M.Code, T.Emp1, T.Emp2, T.Emp3 FROM Master M JOIN Trans T ON M.Code = T.Code;