Sunday, May 6, 2012

[android-developers] Re: SQLITE -query help

how about using max(dateUpdated)  instead?

On Sunday, May 6, 2012 7:56:20 AM UTC-4, David Hodeffi wrote:
i have this DB:

USERS

userId int PK,
userName nvarchar(50)

GAMES

gameId int PK,
dateCreated datetime

ROUNDS

roundId int Pk,
gameId int (FK to GAMES),
dateCreated datetime,
dateUpdated datetime

ROUNDDETAILS

roundId int,
userId int,
point int,
primary key(roundId ,userId)


my problem is that in sqlite i cannot execute this query (cause ther
is no support for "raw_number() over(...)":

select
    AllRound.roundId RoundId,
    AllRound.gameId,
    RD.userId,
    U.userName,
    RD.point
from
    (select
        R.roundId,
        R.gameId,
        dateUpdated,
        row_number() over(partition by gameId order by dateUpdated
desc) Rid
    from GAMES g join ROUNDS R on G.gameId=R.gameId) AllRound
    join ROUNDDETAILS RD on R.roundId=RD.roundId and points
    join USERS U on RD.userId=U.userId
where AllRound.Rid=1


if you familar with sql, so this query returns all the last round of
each game

any suggestions?

thanks in advance, David!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate