I have the following table structure (not all columns specified, only required)
user_master
user_id (primary key)
file name
employee
employee_id (primary key)
user_id (foreign key)
The property
studexperience_master
exp_id (primary key)
user_id (foreign key)
I have 2 mysql queries, fetching data from 3 tables and displaying the form in 1 table (the following queries to search). The first two tables are joined properly, but the problem is that when the next two tables are joined (i.e. employee and studexperience_master), the data is retrieved if the same user_id is said 3 times there than getttin 3 rows in $ result set, which should be only 1 line, I triedDISTINCT ALSO FOR SECOND INNER JOIN BUT ISSUE NOT GETTING SOLVE ,HOW THE QUERY SHOULD BE?
$get_work=mysql_query("SELECT DISTINCT wm.work,wm.status FROM user_master um
INNER JOIN employee emp ON um.user_id =emp.user_id
INNER JOIN studexperience_master wm
ON emp.user_id=wm.user_id
WHERE wm.display='Y' $status_val $company_val $searchkind_val $location_val
$search_Qualification_val");
SELECT um.user_id,
um.fname,
um.lname,
um.email,
um.mobile,
emp.employee_id,
emp.ecountry,
emp.estate,
emp.ecity,
emp.prefcities,
emp.ca,
emp.cs,
emp.cwa,
emp.completed,
emp.persuing
FROM user_master um
INNER JOIN employee emp
ON um.user_id =emp.user_id
INNER JOIN studexperience_master wm
ON emp.user_id=wm.user_id
WHERE wm.display='Y' $status_val
$company_val $searchkind_val $location_val
$search_Qualification_val
and where the sentence values belong to values like this
WHERE wm.display='Y' AND status LIKE '%Fresher%' AND efamiliar LIKE '%Tally %' AND work LIKE 'Excise Audit' AND ecountry LIKE 'pune' OR ecity LIKE 'pune' OR estate LIKE 'pune' OR prefcities LIKE 'pune' AND ca REGEXP '%|CA CPT%' OR cs REGEXP '%|CA CPT%' OR cwa REGEXP '%|CA CPT%' OR completed REGEXP '%|CA CPT%' OR persuing REGEXP '%|CA CPT%'

user_master
user_id- 2
fname- monika
mobile-2147...
email- a@a.b
>employee_id- 1
>user_id- 2
>ecity- Amravati
>ca- CA IPCC Appeared
>cs- CS Executive Appeared
>cwa- CWA Inter Appeared
studexperience_master
ROW1
exp_id-1
user_id- 2
work-Tax AUDIT
ROW2
exp_id-2
user_id- 2
work - VAT AUDIT