Re: problem with sql
- From: bhavik <bhavik@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 12 Apr 2005 03:53:01 -0700
thanks Hari Prasad
your are GRATE.
bhavik shah
"Hari Prasad" wrote:
> 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
>
>
>
.
- References:
- problem with sql
- From: bhavik
- Re: problem with sql
- From: Hari Prasad
- problem with sql
- Prev by Date: Re: problem with sql
- Next by Date: TSQL Date question
- Previous by thread: Re: problem with sql
- Next by thread: TSQL Date question
- Index(es):
Relevant Pages
|
|