1

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
  • 665
  • 1
  • 6
  • 16

2 Answers2

2

Try this query

SELECT * FROM table_name GROUP BY id
Chirag Ghori
  • 4,135
  • 2
  • 18
  • 34
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,270
  • 5
  • 14