Jump to content

question about SQLite


Recommended Posts

You can nest queries:

select * from Table  having rowid (select max(rowid) from Table)

Replace Table with your table.

Link to comment
Share on other sites

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...