2

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?

Shahbaz
  • 805
  • 2
  • 8
  • 20

2 Answers2

3

Try this query

SELECT * FROM table_name GROUP BY id
Chirag Ghori
  • 4,231
  • 2
  • 20
  • 35
1

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.

harpreet seera
  • 1,620
  • 1
  • 7
  • 15