Results 1 to 2 of 2

Thread: Query help

  1. #1
    Join Date
    Jan 2010
    Posts
    1

    Query help

    Hi all,
    I'm trying to run a SELECT query to show information entered on a form in descending order. I have 2 tables:
    userfield
    userid
    field14

    user
    userid
    username

    Both userid fields are the same in each one, and field14 is the number I want sorted in descending order.

    I have the query
    Code:
    SELECT userid,field14 FROM `vb_userfield` WHERE 1
    ORDER BY field14 desc
    which displays as I'd like, but instead of showing userid I'd like to show username on each row.

    Can anyone help me; I think I need to create some kind of join?

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    select u.username, f.field14 from userfiled f
    join user u on u.userid = f.userid
    order by f.field14 desc

Posting Permissions

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