Hello everybody, I have a SQL question that i may want you professionals to do me a favour, thanks!
Suppose I have a table (no primary key) with rows like that:
ID COMMENT
-----------------------------
1 how are you?
1 how do you do?
1 I am fine
2 good morning
3 good evening
3 good night
Ok, I want to get the result that first has distinct groups
of ID, and then get the top row from the groups whose data in COMMENT may be ordered alphabetically. The result is like the below:
ID COMMENT
-------------------------------
1 how are you?
2 good morning
3 good evening
I am still green in SQL statement. I will be happy if some of you may help me
Suppose I have a table (no primary key) with rows like that:
ID COMMENT
-----------------------------
1 how are you?
1 how do you do?
1 I am fine
2 good morning
3 good evening
3 good night
Ok, I want to get the result that first has distinct groups
of ID, and then get the top row from the groups whose data in COMMENT may be ordered alphabetically. The result is like the below:
ID COMMENT
-------------------------------
1 how are you?
2 good morning
3 good evening
I am still green in SQL statement. I will be happy if some of you may help me