Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c# /xamarin forms get randoms items form sqlite datababe

I am using sqlite-net-pcl click here to see

My question is : I am looking for a way to get random items from my sqlite database , I have found the query but I cannot see how to do it with sqlite database

The Query is as follows:

 SELECT * FROM table WHERE id IN(SELECT id FROM table ORDER BY RANDOM() LIMIT x)

sorry for my question. Thanks in advance , if there is a better solution I will take

like image 992
Leaf Leafword Avatar asked Feb 16 '26 20:02

Leaf Leafword


1 Answers

use the Query method

return db.Query<TypeName> ("select * from TableName");
like image 50
Jason Avatar answered Feb 18 '26 11:02

Jason