#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    london
    Posts
    160
    Rep Power
    15
    I have two tables:
    Table one: user_name, address
    (the user_name is unique)
    Table two: user_name, prices
    (this one allows duplicate user_name and prices)

    I want to pick draw up a list of user_names with the highest prices. What is the correct way of joining the two tables?
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    If you don't need the address you don't need the first table.

    select user_name,max(prices) as top_price from table_two group by user_name order by top_price;

Similar Threads

  1. MySQL Select query
    By MrTee1 in forum MySQL Help
    Replies: 0
    Last Post: January 30th, 2004, 11:16 AM
  2. MySQL query using DB driven drop down menu
    By msg270 in forum PHP Development
    Replies: 3
    Last Post: January 22nd, 2004, 04:41 PM
  3. Replies: 1
    Last Post: January 16th, 2004, 07:39 PM
  4. Overwriting mysql query with the query results
    By onerandomday in forum PHP Development
    Replies: 1
    Last Post: January 14th, 2004, 04:45 AM
  5. mysql query problem???
    By mijan10 in forum PHP Development
    Replies: 2
    Last Post: January 4th, 2004, 03:39 PM

IMN logo majestic logo threadwatch logo seochat tools logo