Solved Sqlite rowid lazarus / 16-Databases ---------------------------------------------------------------------- Boekelund · 2020-12-20 19:18 rekord close to, ex SQLQuery2.sql.Text:='select rowid as ID,* from '+aTabel+' where ( (ID=5) or ( ID=6) )' Work fine with 2 record. But SQLQuery2.sql.Text:='select rowid as ID,* from '+aTabel+' where ( (ID=5) or ( ID=ID+1))%u2019 Will only show iID no5. Id+1 will not work.MG How to increase Rowid ? ---------------------------------------------------------------------- marcov · 2020-12-20 19:42 ID is never equal to ID+1, so this doesn't make sense. ---------------------------------------------------------------------- winni · 2020-12-20 20:15 Quote from: Boekelund on December 20, 2020, 08:18:26 pm rekord close to, ex SQLQuery2.sql.Text:='select rowid as ID,* from '+aTabel+' where ( (ID=5) or ( ID=6) )' Work fine with 2 record. But SQLQuery2.sql.Text:='select rowid as ID,* from '+aTabel+' where ( (ID=5) or ( ID=ID+1))’ Will only show iID no5. Id+1 will not work.MG How to increase Rowid ? Hi! It is not clear what you  want. 1: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SQLQuery2.sql.Text:='select rowid as ID,* from '+aTabel+' where ( (ID=5) or ( ID=5+1))’ 2. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ID2 := ID+1;SQLQuery2.sql.Text:='select rowid as ID,* from '+aTabel+' where ( (ID=5) or ( ID2=5))’ Winni ---------------------------------------------------------------------- Boekelund · 2020-12-20 21:42 I try to use Rowid to find the next record in a search among 600000 family names.... So, when I have found a Family name,  as one person , I will look at the person next on the list. Ex, I found the name of the Husband . Next record would be his wife. So to say, a record and the next to be seen in the grid. ---------------------------------------------------------------------- cdbc · 2020-12-20 23:30 Hi why not add one more field to your db, call it "spouseID" and then reference it on insertion, takes no time??? Just my 2 cents worth  Regards Benny ---------------------------------------------------------------------- Boekelund · 2020-12-21 09:14 Quote from: cdbc on December 21, 2020, 12:30:05 amHi why not add one more field to your db, call it "spouseID" and then reference it on insertion, takes no time??? Just my 2 cents worth  Regards Benny Benny The db is pre made with all persons in Name list, so Husb Wife Child are in the same Col. ( it is a db with persons in Denmark from the year of 1787 .....) I can do it with export to  Csv and doing string manipulation, but to slow. So Sql would be nice.... Bo ---------------------------------------------------------------------- cdbc · 2020-12-21 10:53 Hi Bo Ok, I understand, Thinking.... I will return, maybe some our of friends here, who are experts in db and SQL, could have a nifty little solution for you  Regards Benny ---------------------------------------------------------------------- dseligo · 2020-12-21 11:25 I am not sure what are you trying to accomplish, but I'll try to guess. Maybe this is what you want: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SQLQuery2.sql.Text:='select rowid as ID,* from '+aTabel+' where Name=''Husband'' or rowid in (select rowid+1 from atabel where Name=''Husband'')'; If you want result in one row, you could use SQL 'lead' function. ---------------------------------------------------------------------- rvk · 2020-12-21 12:43 How about just using LIMIT? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SQLQuery2.Sql.Text := 'select rowid as ID,* from ' + aTabel + ' where (ID>=5) order by ID limit 2’; ---------------------------------------------------------------------- Boekelund · 2020-12-21 13:50 Thank you all very much for your input. This one from dseligo gives just what I wanted. SQLQuery2.sql.Text:='select rowid as ID,* from '+aTabel+' where name="Jens Jensen" or rowid in (select rowid+1 from '+aTabel+' where name="Jens Jensen")'; Find  about 100 "Jens Jensen', common name here, and the record next.   rowid-1 the prev. So,Thanks Bo ---------------------------------------------------------------------- cdbc · 2020-12-21 14:02 Hi Bo There you go, in this forum, there are many clever people. You just have to ask  Regards Benny