On 8/6/06, Chris W <[EMAIL PROTECTED]> wrote:

David T. Ashley wrote:

> Can I just write something like:
>
> SELECT * FROM mytable WHERE fieldofinterest<value ORDER BY MIN(field1,
> field2) ASC;


I think this will work..

SELECT *, IF(a-b < 0,a, b) as SortField
FROM table
WHERE whatever
ORDER BY SortField


Question:  Is there any way to get SortField (or a similar
per-selected-record field) included with the SELECT output?

The reason for this inquiry is that my PHP script that uses the SELECT
results will also have to calculate SortField as MySQL did as part of the
query.  If MySQL has done it already, no need to do it a second time in the
PHP script.

Thank you.

Reply via email to