Jump to content

Problem with OR operator in query


suffrinmick

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.