Sample data:
I want to get row 1, 5, and 10. I hope you could help me, Thanks.
我想得到第1行,第5行和第10行。我希望你能帮助我,谢谢。
1 个解决方案
#1
0
If you want to have distinct data based on different columnn data, you should use GROUP BY
query.
如果要根据不同的列数据获得不同的数据,则应使用GROUP BY查询。
If you have table called tbl
which has column field1
, field2
and field3
and you want to get all rows which has distinct data for all field in 'tbl', then your query should be like this :
如果您有一个名为tbl的表,其中包含column1,field2和field3,并且您想要获取“tbl”中所有字段具有不同数据的所有行,那么您的查询应如下所示:
SELECT field1, field2, field3
FROM tbl
GROUP BY field1, field2, field3
#1
0
If you want to have distinct data based on different columnn data, you should use GROUP BY
query.
如果要根据不同的列数据获得不同的数据,则应使用GROUP BY查询。
If you have table called tbl
which has column field1
, field2
and field3
and you want to get all rows which has distinct data for all field in 'tbl', then your query should be like this :
如果您有一个名为tbl的表,其中包含column1,field2和field3,并且您想要获取“tbl”中所有字段具有不同数据的所有行,那么您的查询应如下所示:
SELECT field1, field2, field3
FROM tbl
GROUP BY field1, field2, field3