Reputation: 331
I'm trying to select authors where the date in their record, pubMonth + pubYear, has passed. I've tried several combinations of WHERE statements but none of them are eliminating the records that are larger than $today, and that is the only problem.
This is what I have at the moment:
$today = strtotime(date("Y-m-d"));
mysql_select_db($xxxxxxxxxx, $xxxxxxx);
$query_rsfindAuth = "SELECT Author.FirstName, Authors.level2, Authors.pubMonth, Authors.pubYear
FROM Authors
WHERE (UNIX_TIMESTAMP(Author.pubMonth+Author.pubYear)
< $today) AND level2 = 'Nature'
But I've tried each of these, 'cause I'm kinda shooting in the dark.
WHERE ((Authors.pubMonth+Authors.pubYear ) < " . $today . ") AND level2 = 'Nature'
WHERE (Authors.pubMonth+Authors.pubYear ) < $today AND level2 = 'Nature'
WHERE " . strtotime(pubMonth.pubYear ) . " < $today) AND level2 = 'Nature'
WHERE pubMonth+pubYear) < $today) AND level2 = 'Nature'
WHERE (UNIX_TIMESTAMP(pubMonth+pubYear ) < $today) AND level2 = 'Nature'
WHERE UNIX_TIMESTAMP(pubMonth+pubYear ) < " . $today . ") AND level2 = 'Nature'
As always, thank you for your kind help.
Upvotes: 0
Views: 446
Reputation: 191729
WHERE UNIX_TIMESTAMP(CONCAT_WS('-', gradYear, gradMonth, '01')) < '$today'
Upvotes: 1