Skip to content
Advertisement

Getting first two unique records from two table joined – Mysql

Table 1: employee_detail:

Table 2: performance_appraisal

Table 3: financial_details

Expecting Output :

Query i used for :

My Result :

On increasing limit it shows all records from emp_id say emp_id 1 not only the first two records but also all records.

How to get first two records from table with joining another table using MySql.

On using where condition, order by desc with limit 2 I get exact result for one record (one employee). But actually i was trying to get all records(all employees) with first two unique data from financial_details table and performance_appraisal table join. Pls help on it.

EDIT:

Query:

Advertisement

Answer

Here’s something to think about, although, as written, this solution is exclusively for versions pre-8.0…

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement