Subject Re: Using unions
Author rajsubramani
> >select
> >b1.book_id,
> >CAST(0 AS DOUBLE PRECISION) as stock_id,
> >b1.price,
> >string2blob('') as condition from Book b1
> >UNION
> >select
> >bk.book_id,
> >sk.stock_id,
> >sk.price,
> >sk.condition
> >from Book bk
> >join Stock sk on bk.book_id = sk.book_id


> Do you understand the difference between grouping and ordering in
SQL? If
> what you really want is ordering, then place the ORDER BY clause
absolutely
> last, after all of the SELECT specifications, and use the column
numbers as
> arguments.


Ummm, well I think the idea of grouping by book_id was so that the
stock id's (in the second select statement of the UNION) relating to a
book would appear next to the book_id (of the first select statement
of the UNION).

Perhaps creating a view is one way or maybe sorting the array (using
the Java Collections sort routine) or some such trick ....

Thanks for the response.

Cheers
-raj