Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6103179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:41:58+00:00 2026-05-23T13:41:58+00:00

I have two tables: EmployeeInfo Table (table 1) and ItemsInfo Table (table 2): Table

  • 0

I have two tables: EmployeeInfo Table (table 1) and ItemsInfo Table (table 2):

Table 1:

enter image description here

Table 2:

enter image description here

In the UI screen , I have two DIV layers – the left div and the right div. The left div should load data of items not associated to employee and the right div should load the data associated to the employee.

For example, on page load, for employee with empid=201, the data in both div should be populated like this:
enter image description here

To achieve this, I want the mysql query output to be like this:

enter image description here

that is the returned json objects output to be like this :

[{"empid":"","itemid":"1","items":"Apple"},{"empid":"201","itemid":"2","items":"Banana"},{"empid":"","itemid":"3","items":"Baseball"},{"empid":"","itemid":"4","items":"Bikes"},{"empid":"201","itemid":"5","items":"Blue"}]

So that i can push the data to the appropriate div with getJson method. if empid=null, the data to be pushed in the left div else if the empid=201, the data to be pushed n the right div.

I tried with Left Join but, since in table 1, all the field values are repeated more than once, i dont get the exact query output.

Kindly help me how to achieve the above scenario.. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:41:59+00:00Added an answer on May 23, 2026 at 1:41 pm

    Your question is a bit hard to read with all the UI stuff you’re throwing in. To get your requested query output do:

    select t1.empid, t2.itemid, t2.items 
      from Itemsinfo t2 left join EmployeeInfo t1 on t1.itemid=t2.itemid and empid=201;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have two sets of data (two tables) for patient records, one 1999-2003, the other
I have two tables having 1 to 1 relationship. One table called Person and
I have two tables that contain completely separate information: table: tires columns: Tire_id name
I have two tables: who contains these fields: gmdc_employee file_id company_id employee_id employee_name file_description
I have two tables: T1 1,a 2,b T2 2,ggg 3,hhh I want the join
I have two tables. I am updating those tables using entity framework. here is
I have two tables. The first one contains all the item informations and the
I have two tables, where only one column is the same. I am trying
I have two Tables in two different databases Database1 - Table1 Database2 - Table2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.