Shahbaz
Shahbaz

Reputation: 825

How to get Distinct records from SQLITE table in flutter?

I am having a table like this.

enter image description here

I want to write a query in sqlite in flutter to get all the records where id are different. For above table output should be:-

enter image description here

How should I work this out?

Upvotes: 2

Views: 568

Answers (2)

Chirag Ghori
Chirag Ghori

Reputation: 4231

Try this query

SELECT * FROM table_name GROUP BY id

Upvotes: 3

harpreet seera
harpreet seera

Reputation: 1828

Just use the word "distinct on columnName" after the select statement like this:

select distinct on id *
from table

For reference and more clarity check this out.

Upvotes: 1

Related Questions