List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:June 19 2001 7:39pm
Subject:Re: IFNULL issues??
View as plain text  
Also, I notice you have a full cartesian product here.
Aren't you joining these two tables on something?

Bryan Coon wrote:

> I would try:
> 
>     select distinct s.some_pk, IFNULL(s.some_pk, 999) as myid
>     from data_table s, other_data_table
>     where s.some_pk=232 order by myid;
> 
> Although I don't get the purpose of the IFNULL or the order by if you're
> selecting only a single value of s.some_pk.
> 
> --jfarr
> 
> 
> The single value is just used to illustrate the structure of the query.
> 
> I had originally tried using IFNULL as you suggested, but it sorts the table
> differently than if it is used in the order by.  For example, if I have NULL
> values (as a result of a left outer join), they will always appear at the
> beginning of my table.  Using desc is not an option here.  Using IFNULL as
> you suggest replaces the NULL values properly, but they still stay at the
> beginning of the table.  Looks wierd when your table is ordered as: 999,
> 999, 999, 1, 2, 3, 4.  :)  Using IFNULL in the order by fixes this.
> 
> Bryan 
> 
> ---------------------------------------------------------------------
> 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 <mysql-thread77088@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-- 
Gerald L. Clark
gerald_clark@stripped

Thread
IFNULL issues??BCC19 Jun
  • Re: IFNULL issues??Cal Evans19 Jun
  • Re: IFNULL issues??Jonothan Farr19 Jun
RE: IFNULL issues??Bryan Coon19 Jun
RE: IFNULL issues??Bryan Coon19 Jun
  • Re: IFNULL issues??Gerald Clark19 Jun
    • Setting mySQL for a userWebNomad Inc.19 Jun
  • Re: Setting mySQL for a userRolf Hopkins20 Jun