MYSQL - Query to check against other table (hard to explain...)

Posted by Sam on Stack Overflow See other posts from Stack Overflow or by Sam
Published on 2010-03-12T02:36:31Z Indexed on 2010/03/12 2:37 UTC
Read the original article Hit count: 123

Filed under:
|
|

I have a query that gets a list of emails who have subscribed for a newsletter trial which lasts 30 days..

$thirty = time() - 3024000;

SELECT c.email FROM tbl_clients AS c JOIN tbl_clientoptions AS o ON o.client = c.id WHERE o.option = 'newsletter' AND c.datecreated > $thirty

What I want to do is do a check in that same query so it also returns clients OVER 30 days old if they have the tbl_clientoptions.option = 'trialoverride' (ie; a row in the client options table with the value "trialoverride")

basic columns are:
TBL_CLIENTS
id,name,email,datecreated

TBL_CLIENTOPTIONS
id,client,option

© Stack Overflow or respective owner

Related posts about mysql

Related posts about query