Jump to content

Recommended Posts

Hi I have 4 tables to search the data from

 

1. user

2. user_courses

3. user_spouse

4. user_children

 

I have a form for searching a user on the following fields. 1. Name, Course Subscribed, Hobbies. If someone selects a hobby then the program must search for user's own hobby, user_spouse's hobby and user_children's hobby.

 

The query I am writing is:

 

Select * from user U

LEFT JOIN user_children UCh ON UCh.mem_id = U.mem_id

LEFT JOIN user_courses UC ON UC.mem_id = U.mem_id

LEFT JOIN user_spouse US ON US.mem_id = U.mem_id

WHERE 1 AND (U.firstname LIKE '%Yash%') AND (UC.course_id = 4) AND (U.hobbies = 1 OR UCh.child_hobbies = 1 OR US.spouse_hobbies = 1)

 

But keep getting the error: Unknown column 'UCh.child_hobbies' in 'where clause'.

I've checked repeatedly and the fieldname is correct. Not able to understand where the problem is

 

Plz help

Akash

Link to comment
https://forums.phpfreaks.com/topic/172087-problem-with-left-join-using-php/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.