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