MySQL Forums
Forum List  »  General

Ordering within non-ordered rows
Posted by: Rob Earls
Date: January 28, 2009 04:12AM

I have a table with orders in it, which are generally listed in chronological order. (Actually it's much more complicated than that, but lets simplify it for now)

e.g.

OID batch_id
722 0
726 2
757 2
758 0
759 2
773 0
788 0

Is there a way to still order in chronological order, but when a batch is not = 0 then to group the orders together..

e.g.

OID batch_id
722 0
726 2 *
757 2 *
759 2 *
758 0
773 0
788 0

See the items marked with * are batched orders, and therefore must stick together.

Hopefully the example makes sense. Its very tricky to put into words.

I can't think of a way to do this, can you?

Thanks in advance.



Edited 2 time(s). Last edit at 01/28/2009 04:46AM by Rob Earls.

Options: ReplyQuote


Subject
Written By
Posted
Ordering within non-ordered rows
January 28, 2009 04:12AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.