Announcement

Collapse
No announcement yet.

Have you got yer book? Inner joins on members table?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Chen
    replied
    Code:
    ERROR 1052: Column: 'userid' in order clause is ambiguous
    Try:
    Code:
    SELECT user.userid,userfield.field3,userfield.field4 FROM user LEFT JOIN userfield USING (userid) ORDER BY user.joindate DESC LIMIT 50;

    Leave a comment:


  • TheHideoutGuy
    replied
    Try:

    Code:
    SELECT user.userid,userfield.field3,userfield.field4  FROM user LEFT JOIN userfield ON (userfield.userid=user.userid) ORDER BY userid DESC LIMIT 50
    to retreive the 50 newest users. Change the DESC to an ASC to get the 50 oldest users.

    Leave a comment:


  • rawnet
    started a topic Have you got yer book? Inner joins on members table?

    Have you got yer book? Inner joins on members table?

    Hi,

    I'm creating a page which should integrate with my vBulletin database and would like to display the last 50 members to join.

    However, as well as the USER table I suspect I need to use the USERFIELD table as I want to display data contained within field3 and field4 of the USERFIELD table.

    I'm a PHP newbie and am a bit unsure how to do this. I believe I need to do something like an INNER JOIN, but I've left my SQL book in the office and am a bit lost without it.

    The fields I need to display are :

    USER - userid
    USERFIELD - userid, field3, field4

    Can anybody help?

    Ross

Related Topics

Collapse

Working...
X