Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    77

    Unanswered: 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 ???

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •