Max date

I have 2 tables


id|name
-+----------
1|st1
2|an2
1|st1
2|an2
--------------

id|date
-+----------
1|2002
2|2003
1|2010
2|2011
--------------

i want to retrive max date with name like this


name|date
---+----------
st1 |2010
an2|2011
--------------

any help??

SELECT table1.name
     , MAX(table2.date) AS maxdate
  FROM table1
INNER
  JOIN table2
    ON table2.id = table1.id
GROUP
    BY table1.name

Sorry I’ve been given the wrong example
the correct example

id|name
-±---------
1|st1
2|st2
3|an2
4|an4

id|date|group
-±---------
1|2002|St
2|2003|St
3|2010|an
4|2011|an

retrive

id|date|group
-±---------
st2|2003
an4|2011

what you just posted makes no sense

please explain in words how you think the results can be achieved

what happened to st1 and an2?

table1 (book issues)

table2(book name and publishdate of issue)

I want to Retrieve the latest issue and its pubdate or ( all of the issues for the last(max) year)

can you please give the exact table specifications

for example, if this is mysql, plese do a SHOW CREATE TABLE for each table

CREATE TABLE IF NOT EXISTS articles (
articleid int(11) NOT NULL auto_increment,
title mediumtext,
booktitle mediumtext,
pubdate smallint(6) default NULL,
PRIMARY KEY (articleid))
) ;

CREATE TABLE IF NOT EXISTS issues (
issueid int(11) NOT NULL auto_increment,
articleid int(11) NOT NULL default ‘0’,
issue varchar(255) default NULL,

PRIMARY KEY (issueid),
) ;

i want to retrive last issue of book(issue) and pubdate

okay, thanks for that

i am still having trouble understanding what it represents

so each article can have multiple issues?

also, what does “last issue of book(issue)” mean? what’s in that VARCHAR(255) column?

no each book have issues

book1(issue column)(book1,v1 – book1,v2 – book1,v3 | book2,v1 – book2,v2 – book2,v3) and each issue have articles

and booktitle at table1 is name of the book

so i need retrieve (book1,v3 — book2,v3) and thier dates(pubdate)

i am sorry, i cannot continue trying to figure out your tables

nothing really makes sense to me, sorry