select max(time) as time from albums_data where album_userid =27;
I was using this its going fine.
But If I want to get another col like source col it gives error : In aggregate and grouping expressions, the SELECT clause can contain only aggregates and grouping expressions. [ Select clause = ,source ]
select source, max(time) as time from albums_data where album_userid = 27
Please "Marks As Answer" if any answer helped you out!
~~! FIREWALL !~~
Afzaal.Ahmad...
Contributor
2661 Points
1040 Posts
max value in SQL CE
Dec 20, 2012 12:16 PM|LINK
How can I select two cols while one is in max.
I was using this its going fine.
But If I want to get another col like source col it gives error : In aggregate and grouping expressions, the SELECT clause can contain only aggregates and grouping expressions. [ Select clause = ,source ]
~~! FIREWALL !~~
oned_gk
All-Star
31798 Points
6499 Posts
Re: max value in SQL CE
Dec 20, 2012 12:21 PM|LINK
senthilwaits
Contributor
3832 Points
651 Posts
Re: max value in SQL CE
Dec 20, 2012 12:28 PM|LINK
You can use Group by
Senthil Kumar Sundaram
Afzaal.Ahmad...
Contributor
2661 Points
1040 Posts
Re: max value in SQL CE
Dec 20, 2012 02:49 PM|LINK
oned_gk But this gives me all the fields. While I just want to get one result with the max time.
~~! FIREWALL !~~
dblaire
Member
110 Points
26 Posts
Re: max value in SQL CE
Dec 20, 2012 09:40 PM|LINK
As oned_gk and senthilwaits answered:
</div> </div>The above will show 2 columns, "source" and "time". No other columns should be displayed.</div> </div>senthilwaits
Contributor
3832 Points
651 Posts
Re: max value in SQL CE
Dec 21, 2012 03:44 AM|LINK
If you want only one row you can use
Senthil Kumar Sundaram
GmGregori
Contributor
5470 Points
737 Posts
Re: max value in SQL CE
Dec 21, 2012 05:15 AM|LINK
Try with
but senthilwaits's answer is better (I haven't seen it before replying).