Find users who have not uploaded certain contents in last 30 days
SQL is evaluated backwards, from right to left. So the WHERE clause is parsed and evaluate prior to the SELECT clause. Because of this the aliasing of MAX(created) to max_created not yet occurred.

You can try this,


  SELECT uid, MAX(created) FROM node WHERE node.type IN ('page','story')
  HAVING MAX(created) &lt; UNIX_TIMESTAMP()-2592000