Jump to content

Recommended Posts

Hi. I've created a query in dreamweaver to extract emails from a customer list table against a "training courses booked" table, but I want to exclude customers who have cancelled or transferred from a course:

SELECT DISTINCT

customer_list.customer_no,

customer_list.customer_name,

course_title.course_title,

courses.course_location,

customer_list.postcode,

customer_list.email

FROM

customer_training_info,

customer_list,

course_title,

courses

WHERE (postcode BETWEEN pcode_begin AND pcode_end AND date_booked BETWEEN begin AND end AND customer_training_info.customer_id = customer_list.customer_id AND customer_training_info.course_title_id = courses.course_id AND courses.course_title = course_title.ctID AND course_title.ctID = course01 AND customer_list.email != '')

 

I can create a list of customers who have booked course01 (for example), and I can add to the end of my query: customer_training_info.cancel != 'TRUE' which will then only include any customers where cancelled is not true.

 

I can also change this to: customer_training_info.transfer != 'TRUE' which will then include only customers where transferred is not true.

 

But when I add this to the end of my query:

AND ((customer_training_info.transfer != 'TRUE') || (customer_training_info.cancel != 'TRUE')) which I think should then include customers who have EITHER cancelled OR transferred, it doesn't work.

 

Any ideas where I'm going wrong?

 

Thanks

Paul

Link to comment
https://forums.phpfreaks.com/topic/144678-problem-with-or-operator-in-query/
Share on other sites

Sorry - should be:

But when I add this to the end of my query:

AND ((customer_training_info.transfer != 'TRUE') || (customer_training_info.cancel != 'TRUE')) which I think should then EXCLUDE customers who have EITHER cancelled OR transferred, it doesn't work.

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.