Subject | Re: Using unions |
---|---|
Author | rajsubramani |
Post date | 2004-02-05T08:05:54Z |
> >selectSQL? If
> >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
> what you really want is ordering, then place the ORDER BY clauseabsolutely
> last, after all of the SELECT specifications, and use the columnnumbers 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