sql - How can I get sets of 2 entries where each set starts with a different letter and no letter is repeated from a sqlite database? -
like this:
apple aardvark banana bet cow car ... zipper zoo
assuming database has more 2 different entries start of letters. thinking of doing top , wildcards, don't know enough sql pull off. can do?
you can substr
function , correlated subquery:
select * yourtable wordfield in (select wordfield yourtable b substr(a.wordfield ,1,1) = substr(b.wordfield ,1,1) order wordfield limit 2)
demo: sql fiddle
you can use order by
adjust 2 records returned. order random()
if that's supported.
Comments
Post a Comment