SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Join question

  1. #1
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Join question

    Hi,

    I have the following SQL query. I'm trying to return all domains from the domains table along with the corresponding user information. At the moment, the query returns all domains, but is it possible to return users even if they have no domains listed in the domains table?

    Code:
    SELECT dt_users.id, dt_users.username, dt_users.email_address, dt_users.first_name, dt_users.last_name, dt_users.lastlogin, dt_domains.domain, dt_domains.minimum_offer, dt_domains.bin_price
    FROM dt_users
    LEFT OUTER JOIN dt_domains ON dt_domains.owner = dt_users.id
    GROUP BY dt_domains.id

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Get rid of the GROUP BY


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
  •