Zandis Murāns Posted March 12, 2008 Report Share Posted March 12, 2008 Kā lai dabū tabulas pirmo un pēdējo rindu bez php? Link to comment Share on other sites More sharing options...
andrisp Posted March 12, 2008 Report Share Posted March 12, 2008 Pēc kā skatoties pirmo un pēdējo ? Pēc ID ? SELECT * FROM table ORDER BY id ASC LIMIT 1 SELECT * FROM table ORDER BY id DESC LIMIT 1 Ja baigi gribas, lai vienā kverijā: (SELECT * FROM table ORDER BY id ASC LIMIT 1 ) UNION (SELECT * FROM table ORDER BY id DESC LIMIT 1 ) Link to comment Share on other sites More sharing options...
Zandis Murāns Posted March 12, 2008 Author Report Share Posted March 12, 2008 Derēs. Link to comment Share on other sites More sharing options...
Aleksejs Posted March 12, 2008 Report Share Posted March 12, 2008 vai arī SELECT * FROM tabula WHERE lauks IN (SELECT MAX(lauks) FROM tabula) OR lauks IN (SELECT MIN(lauks) FROM tabula) bet tas negarantē tieši divu rezultātu atgriešanu. Link to comment Share on other sites More sharing options...
Zandis Murāns Posted March 12, 2008 Author Report Share Posted March 12, 2008 Nederēs. Link to comment Share on other sites More sharing options...
Recommended Posts