If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Query Help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-13-09, 11:38
sunfire sunfire is offline
Registered User
 
Join Date: Aug 2003
Posts: 19
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
Reply With Quote
  #2 (permalink)  
Old 11-13-09, 13:22
mnirwan mnirwan is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 11-13-09, 19:17
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On