sql Inner Join
I have two tables. The first table name register.
Second table name showrank
I want to show the Player_name who get the maximum Totalgainloss and also sho the number 0f totalgainloss.
sql="SELECT max(totalgainloss)as cashAV showrank.*, register.* FROM showrank INNER JOIN register ON showrank.id = register.id;"
if not (HighPrice.eof) then
But it did not work !!
Maybe this will work.. This assumes that there is only one record in the showrank table to match the one record in the register table. It would be different if I was coding a ONE->MANY relationship.
SELECT register.Player_Name, showrank.totalGainLoss
FROM register INNER JOIN showrank ON register.id = showrank.id
ORDER BY showrank.totalGainLoss DESC;
SELECT Top 1 PlayerName, Max(Totalgainloss) as highGainLoss
FROM register r
INNER JOIN showrank s
On s.id = r.id
GROUP BY PlayerName
ORDER by Max(Totalgainloss) DESC
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)