You could try using the IFNULL() function on that column before you do the join.

http://www.mysql.com/doc/C/o/Control_flow_functions.html

--jfarr

----- Original Message ----- 
From: "Bryan Coon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 11:12 AM
Subject: left outer join query question


> Hi, I am having a small formatting problem maybe someone can help with.
> 
> I have a query that does a left outer join, which generates a table with a
> few NULL values in some columns.  All okay so far.  But what I need to do is
> sort on this column, and I need to put NULL values at the end.  Normally I
> would just set all NULL values to be some number like 100, but since they do
> not exist before the join I cannot do this.  Is there a way to assign a
> value in the query?  Like if col2=NULL col2=100?  Or maybe some other nice
> little trick?  I looked in the manual, the Paul DuBois book, and usenet.
> Didn't find anything useful.
> 
> Thanks!
> 
> What I have:
> col1 col2
> ----------------
> a 1
> b 3
> c NULL
> d 2
> e NULL
> f 4
> 
> What I want:
> col1 col2
> ----------------
> a 1
> d 2
> b 3
> f 4
> c NULL
> e NULL
> 
> What I get:
> col1 col2
> ----------------
> c NULL
> e NULL
> a 1
> d 2
> b 3
> f 4
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to