Results 1 to 3 of 3

Thread: Query Help

  1. #1
    Join Date
    Aug 2003
    Posts
    19

    Unanswered: Query Help

    Hello,
    I'm not sure what function I'm looking for but what I'm wanting to do is group all of the a.version by NULL vs Not NULL no matter what the version value is.

    What do I need to do?

    select c.name, c.address, a.version
    From clients c
    Left Join app_Info a
    ON c.uid = a.uid

  2. #2
    Join Date
    Sep 2009
    Posts
    64
    Code:
    select c.name, c.address, IF(a.version IS NULL, 'version null', 'version not null') as version
    From clients c
    Left Join app_Info a
    ON c.uid = a.uid
    GROUP BY 3

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    SELECT c.name
         , c.address
         , a.version
      FROM clients c 
    LEFT OUTER
      JOIN app_Info a
        ON a.uid = c.uid 
    ORDER
        BY a.version
    all the NULL versions will be grouped together
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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