Sam Carleton wrote: > I can determine the number of title before lasttitle with this: > > SELECT COUNT(title) FROM tracks > WHERE singer='Madonna' > AND title<:lasttitle > > I am having a problem doing this when scrolling backword. Again here is the > SQL from the Wiki to get the display set: > > SELECT title FROM tracks > WHERE singer='Madonna' > AND title<:firsttitle > ORDER BY title DESC > LIMIT 5;
Something like SELECT COUNT(title) - 5 FROM tracks WHERE singer='Madonna' AND title<:firsttitle; and then in your host app check for negative values and treat them as zero. Or, if you insist on doing that in SQL: select (case when c > 0 then c else 0 end) from (SELECT COUNT(title) - 5 as c FROM tracks WHERE singer='Madonna' AND title<:firsttitle); Igor Tandetnik _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

