you forgot to mention which database, so i shall assume your database is
standards compliant and supports the CASE structure

   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

there may be a sort option (i think mysql has one, can't remember if sql
server does) where you can set something so that nulls sort last, in which
case you don't need the above nonsense

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)


rudy


____ • 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