--- Michael Fuhr <mike@fuhr.org> wrote:
> On Thu, Jan 12, 2006 at 12:07:12PM -0800,
> operationsengineer1@yahoo.com wrote:
> > SELECT DISTINCT t_product.product_id,
> > t_product.product_number,
> > t_serial_number.serial_number_id,
> > t_serial_number.serial_number
> [...]
> > ORDER BY t_serial_number.serial_number::int ASC
> >
> > resulting error:
> >
> > ERROR: for SELECT DISTINCT, ORDER BY expressions
> must
> > appear in select list
>
> What data type is serial_number? I'm guessing not
> integer, else
> you wouldn't be casting it to integer in the ORDER
> BY clause. If
> you need that cast then also use it in the SELECT
> list:
>
> SELECT DISTINCT t_product.product_id,
> t_product.product_number,
> t_serial_number.serial_number_id,
> t_serial_number.serial_number::int
>
> --
> Michael Fuhr
>
Excellent! it worked - thank you very much, Michael.
i would've never made that connection.
serial_number is text. i went that route b/c i
thought i'd never do any math on serial_number. then
i learned how text sorts on numeric data -lol-
as an aside, the forms class i use was only outputting
one instance out of three in the array i created.
three in, one out. this process enabled the
highlighting of unexpected behavior in another piece
of software.
thanks again.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com