SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru Angry Coder's Avatar
    Join Date
    May 2002
    Location
    Canada
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting the most popular author...

    Hello,

    I have 2 tables:

    article
    --- artid
    --- author_id
    --- title
    --- text

    author
    --- authid
    --- name

    How can I get the name and ID of the author who has the biggest amount of articles?

    Thanks.
    Why It Doesn't Work?!

  2. #2
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this:
    Code:
    SELECT MAX(a.author_id) , b.name
      FROM article a
    LEFT 
      JOIN author b 
        ON a.author_id = b.authid
    GROUP 
        BY a.author_id
    LIMIT 0,1
    my mobile portal
    ghiris.ro

  3. #3
    SitePoint Guru Angry Coder's Avatar
    Join Date
    May 2002
    Location
    Canada
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much.
    Why It Doesn't Work?!


Bookmarks

Posting Permissions

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