I have 2 tables tbl_UserRegistration and tbl_Streaks with structures like this:
tbl_UserRegistration
DATATYPE LENGTH
UserName Text 25 (PRIMARY KEY)
PhotoLink Text 150
DeviceToken Integer 15
DeviceType Integer 1
tbl_Streaks
DATA TYPE LENGTH
ID Integer 10 (PRIMARY KEY)
Player1 Text 25
Player2 Tex 25
Streaks Integer 10
Now I want to fetch players who have highest streak with their photolink.
EDITED :
i.e. Player1, Player2, MAX(streak), Photolink
How can I do this?
What can be sql query ?
thanks..
NOTE- Player1 and Player2 and UserName are equal..
You can retrieve
PhotoLinkfor both users by joining totbl_UserRegistrationtwice. To get the pair of players who scored the most, you could sort the rows in the descending order ofStreakand limit them to only one row, like this: