Digisoul Posted May 4, 2010 Share Posted May 4, 2010 Hello There, I want to know that if i have 1000 records in SQLite DB, how can retrieve the data from the last Row ? Thanks in Advance. 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
JRowe Posted May 4, 2010 Share Posted May 4, 2010 You can nest queries: select * from Table having rowid (select max(rowid) from Table) Replace Table with your table. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Digisoul Posted May 4, 2010 Author Share Posted May 4, 2010 You can nest queries: select * from Table having rowid (select max(rowid) from Table) Replace Table with your table. Thank you very much JRowe. 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
Digisoul Posted May 4, 2010 Author Share Posted May 4, 2010 Its give me this error ? ! SQLite.au3 Error --> Function: _SQLite_Query --> Query: select id from Area having rowid (select max(rowid) from Area); --> Error: near "select": syntax error 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
Yoriz Posted May 4, 2010 Share Posted May 4, 2010 Try this select * from Table where rowid in (select max(rowid) from Table) Again replace Table with your table. GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
Digisoul Posted May 4, 2010 Author Share Posted May 4, 2010 Try this select * from Table where rowid in (select max(rowid) from Table) Again replace Table with your table. Not worked, but this worked "SELECT * FROM Table WHERE ROWID = ( SELECT MAX(ROWID) FROM Table) ;" 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
Yoriz Posted May 4, 2010 Share Posted May 4, 2010 select * from Table where rowid in (select max(rowid) from Table) works just fine, both ways work. #include <SQLite.au3> #include <SQLite.dll.au3> Local $aRow _SQLite_Startup () ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF) _SQLite_Open () ; open :memory: Database _SQLite_Exec(-1,"CREATE TEMP TABLE settings (key,value);") _SQLite_Exec(-1,"INSERT INTO settings (key,value) VALUES ('1','setting one');") _SQLite_Exec(-1,"INSERT INTO settings (key,value) VALUES ('2','setting two');") _SQLite_Exec(-1,"INSERT INTO settings (key,value) VALUES ('3','setting Three');") _SQLite_Exec(-1,"INSERT INTO settings (key,value) VALUES ('4','setting Four');") _SQLite_QuerySingleRow(-1,"SELECT value FROM settings where rowid in (select max(rowid) from settings);",$aRow) ; Select single row and single field ! ConsoleWrite("SELECT value FROM settings where rowid in (select max(rowid) from settings); returns = " & $aRow[0] & @CR) _SQLite_QuerySingleRow(-1,"SELECT value FROM settings WHERE ROWID = ( SELECT MAX(ROWID) FROM settings);",$aRow) ; Select single row and single field ! ConsoleWrite("SELECT value FROM settings WHERE ROWID = ( SELECT MAX(ROWID) FROM settings); returns = " & $aRow[0] & @CR) _SQLite_Close () _SQLite_Shutdown () ;Console output _SQLite_LibVersion=3.6.22 ;Console output SELECT value FROM settings where rowid in (select max(rowid) from settings); returns = setting Four ;Console output SELECT value FROM settings WHERE ROWID = ( SELECT MAX(ROWID) FROM settings); returns = setting Four GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now