If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > inner join

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-08-04, 10:28
gop373 gop373 is offline
Registered User
 
Join Date: Aug 2004
Posts: 77
inner join

I have two tables. The first table name register.
id
Player_name
Email

Second table name showrank
id
Totalgainloss
CashAV

I want to show the Player_name who get the maximum Totalgainloss and also sho the number 0f totalgainloss.
I tried

sql="SELECT max(totalgainloss)as cashAV showrank.*, register.* FROM showrank INNER JOIN register ON showrank.id = register.id;"
set HighPrice=server.createobject("adodb.recordset")
HighPrice.open sql,conn,1,3

if not (HighPrice.eof) then
response.write HighPrice("cashAV")
response.write HighPrice("Player_name")
end if

But it did not work !!
Reply With Quote
  #2 (permalink)  
Old 12-08-04, 11:48
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
Would this be OK?
Code:
SELECT r.player_name, s.totalgainloss
FROM register r, showrank s
WHERE r.id = s.id
  AND s.totalgainloss = (SELECT MAX(s1.totalgainloss)
						 FROM showrank s1
						);
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On