SELECT * FROM loginTable WHERE ´account´= 2 && ( logindate = MAX(logindate) || logindate = MIN(logindate) )