Re: problem with sql
- From: "Hari Prasad" <hari_prasad_k@xxxxxxxxxxx>
- Date: Tue, 12 Apr 2005 05:33:29 -0500
TRY THIS:-
SELECT userid, max(datetime) as date
FROM UserLocationHistory
Group by userid
ORDER BY userid
Thanks
Hari
SQL Server MVP
"bhavik" <bhavik@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E157B034-E349-4EA8-B165-3BDC557EBE6F@xxxxxxxxxxxxxxxx
> hi
>
> I have problem with sql. I dont userstand what should I do.
> my problem is
>
> I have table UserLocationHistory
>
> I want those user who have latest date.
> I am fired sql like
>
> SELECT DISTINCT userid, datetime
> FROM UserLocationHistory
> ORDER BY userid, datetime DESC
> UserID datetime
> 80 1/5/2005
> 80 1/4/2005
> 80 1/2/2005
> 124 1/3/2005
> 124 1/2/2005
> 124 1/1/2005
> 130 1/3/2005
> 186 1/1/2005
>
>
> but I wnat this reasult like
>
> UserID datetime
> 80 1/5/2005
> 124 1/3/2005
> 130 1/3/2005
> 186 1/1/2005
>
> so please help me out
>
> regards,
> bhavik
.
- Follow-Ups:
- Re: problem with sql
- From: bhavik
- Re: problem with sql
- References:
- problem with sql
- From: bhavik
- problem with sql
- Prev by Date: problem with sql
- Next by Date: Re: problem with sql
- Previous by thread: problem with sql
- Next by thread: Re: problem with sql
- Index(es):
Relevant Pages
|
|