mysql - SQL to select email and max id -


i have table records email addresses newsletter purposes. when subscribes sets subscribe ind 'y' , there incremental id. when subscribes/unsubscribes, need select table entries email address, select based on highest id.

once have info can use subscribe ind see if subscribed or not. have been trying figure 1 out without success. trying like:

mysql_query

select * newsletter email=$email ,  id=(select max(id) newsletter)

should doing else?

select col1,col2,max(id) newsletter  email=$email group col1,col2 

edit

select * newsletter  email=$email , id in (select max(id) newsletter group email) 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -