
mysql> select mn.journal_id, mn.impact_factor, mn.year, `yearcount`.`lastyear` from impact_factors as mn join (select i.journal_id as jjid, max(i.year) as `lastyear` from impact_factors i group by i.journal_id) as `yearcount` on (mn.journal_id = `yearcount`.jjid) where mn.journal_id in (92, 35, 29, 97); +------------+---------------+------+----------------------+ | journal_id | impact_factor | year | lastyear | +------------+---------------+------+----------------------+ | 29 | 7.603 | 2005 | 0008 | | 29 | 7.883 | 2002 | 0008 | | 29 | 7.764 | 2006 | 0008 | | 29 | 8.624 | 2001 | 0008 | | 29 | 7.663 | 2003 | 0008 | | 29 | 10.088 | 1999 | 0008 8 | etc... | 92 | 11.088 | 2005 | 0008 8 | | 92 | 11.295 | 2004 | 0008 5 | | 92 | 10.751 | 2002 | 0008 1 | | 92 | 9.868 | 2006 | 0008 | | 92 | 11.081 | 2001 | 0008 1 | etc... Thanks to Sofie for noticing a corelation between impact_factor and lastyear. Anyone knows how to get me a '2008' in lastyear? T. -- ================================================================== Thomas Van Parys Tel:+32 (0)9 331 36 95 fax:+32 (0)9 3313809 VIB Department of Plant Systems Biology, Ghent University Technologiepark 927, 9052 Gent, BELGIUM thomas.vanparys@psb.vib-ugent.be http://bioinformatics.psb.ugent.be ==================================================================