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 problem

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

I have two tables.
First table name "create_group"
group_id
email
country
name
The second table name "showrank_group"
group_id
totalgainloss

sql="SELECT create_group.*, showrank_group.totalgainloss FROM create_group INNER JOIN showrank_group ON create_group.group_id = showrank_group.group_id ORDER BY showrank_group.totalgainloss DESC ;"

I want to join these twos tables so I tried the sql above, it is ok. But now I don't want to show the last row of both table create_group and table showrank_group. How can I write the sql ???
Reply With Quote
  #2 (permalink)  
Old 12-15-04, 09:37
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
How about:
Code:
SELECT create_group.*, showrank_group.totalgainloss
  FROM create_group
 INNER JOIN showrank_group
    ON create_group.group_id = showrank_group.group_id
 WHERE showrank_group.totalgainloss <> 
    ( SELECT MIN(showrank_group.totalgainloss)
        FROM create_group
       INNER JOIN showrank_group
          ON create_group.group_id = showrank_group.group_id
    )
ORDER BY showrank_group.totalgainloss DESC;
BTW, it is more usual to name your tables with nouns rather than with actions - e.g. group and group_rank.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
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