Re: [MySQL] Using the MAX() value in WHERE clause

2004-04-28 Thread Michael Stassen
jim wrote: One solution would be to use a variable: SELECT @latest:= MAX(dateCreated); Here I am getting the errors: mysql> SELECT @latest:= MAX(dateCreated); ERROR 1054: Unknown column 'dateCreated' in 'field list' mysql> SELECT @latest:= MAX(user.dateCreated); ERROR 1109: Unknown table 'use

Re: [MySQL] Using the MAX() value in WHERE clause

2004-04-28 Thread jim
> jim wrote: > > > Hi, > > > > The task is to find users whose accounts have not been validated for the > > last 10 days. This SELECT accomplishes that: > > > > SELECT * FROM user WHERE validated LIKE 'N' AND dateCreated <= > > DATE_SUB(CURDATE(), INTERVAL 10 DAY) > > > > But, using curdate()

Re: [MySQL] Using the MAX() value in WHERE clause

2004-04-28 Thread Michael Stassen
jim wrote: Hi, The task is to find users whose accounts have not been validated for the last 10 days. This SELECT accomplishes that: SELECT * FROM user WHERE validated LIKE 'N' AND dateCreated <= DATE_SUB(CURDATE(), INTERVAL 10 DAY) But, using curdate() is dangerous. What if the system time is

[MySQL] Using the MAX() value in WHERE clause

2004-04-28 Thread jim
Hi, The task is to find users whose accounts have not been validated for the last 10 days. This SELECT accomplishes that: SELECT * FROM user WHERE validated LIKE 'N' AND dateCreated <= DATE_SUB(CURDATE(), INTERVAL 10 DAY) But, using curdate() is dangerous. What if the system time is messed up?