rudy suggested:

   select contactID, (fname + ' ' + lname) as fullname, email
   from contacts
   where active = 1
   order by
       case when lname is null then '99999999999' else lname end
     , case when fname is null then '99999999999' else fname end
     , email

however, it's a nice technique to know if the fields are empty rather
than null (in which case you test lname='' instead of lname is null)

Tim:
Sweet, rudy.  :-)  Little stuff like this make me realize how much I
still need to learn, even though I've been building SQL databases for
3-4 years now.  My usual approach to a problem like this is to do a
couple of sub-selects and then UNION them.  It'd be interesting to
compare speeds between the two methods.

Tim
___________________________ 
Tim Furry
Web Developer 
Foulston Siefkin LLP 




____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
       Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set 
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to