To whom it may concern,
I have a case in a select statement I am using and it looked like this:
CASE
        WHEN
                discount.price is not null
        THEN
                discount.price
        ELSE
                prod.price
END as sort_price

and I noticed the order was all screwed up.... so I ran the query on the
command line and the contents of sort_price was the same exact number for
each result and that number was the value of the last record returned's
prod.price.  Duno why, but, I decided I would try the following:

CASE
        WHEN
                discount.price is null
        THEN
                prod.price
        ELSE
                discount.price
END as sort_price

And all the sudden everything was working properly...  The types of the
columns in question here are decimal(9,2).  The reason discount.price was
ever null is I am doing a left join across that table and doing my overall
sort on whichever price is valid for a given product.  If you need any more
info from me I will be happy to provide it.
    Thanks,
        Paul Tinsley

--
Senior Developer
Acymtech Inc.

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