比如,有一張表ID為自增:
CREATE TABLE Product
(
ID INTEGER PRIMARY KEY AUTOINCREMENT,
Name NVARCHAR(100) NOT NULL
)
那麼,插入的sql就是:
INSERT INTO Product VALUES(NULL,'產品名稱')
GO
select top 1 oid from orderinfo order by oid desc ;(×)
select oid from orderinfo order by oid desc limit 0,1;(√)