Here is my SQL statement i am unable to run it:
SELECT fm . * , mp.first_name, mp.last_name, mp.image, mp.member_id
FROM featured_members AS fm
JOIN member_profiles AS mp WHERE fm.member_id = mp.member_id
AND fm.member_type_id =6
AND fm.site_id =1
when i run it it gives me #1054 - Unknown column 'fm.site_id' in 'on clause' error
is there a syntax problem because fm table does have that site_id column but i don’t know why SQL is not fetching it??
My Tables Structure for featured_members is like this:
1 sr_no
2 member_id
3 member_type_id
4 site_id
and for member_profiles the structure is:
1 member_profile_id
2 member_id
3 first_name
4 middle_name
5 last_name
6 gender
7 image
You’re doing it wrong:
With JOIN’s it is mandatory to use the ON clause, unless otherwise it’s a cross join.