Hi Simon, Two or more rows return is an error on user definition. I will popup a message in this case. Thanks for the example, I didn't know <= can be used also for strings.
Regards, Ertan Küçükoğlu -----Original Message----- From: sqlite-users-boun...@mailinglists.sqlite.org [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Simon Slavin Sent: Thursday, May 26, 2016 1:55 PM To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Subject: Re: [sqlite] Finding a single row On 26 May 2016, at 11:44am, Ertan Küçükoğlu <ertan.kucuko...@1nar.com.tr> wrote: > I need to find a single row in my table which begins as the complete > card number, or I need to know no match exists in my table. What happens if two rows match ? Ignoring that question for a while, what you're looking for is the row which sorts immediately before the complete card code you're searching for. SELECT Kodu FROM FIYATKODLARI WHERE Kodu <= '<searchcode>' ORDER BY Kodu DESC LIMIT 1 In your programming langauge take a look at the value returned and see if it is the same as the first n characters of the value you're searching for. If it is, you have a match. If not, you don't. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users