Hey all,
I got an interesting problem that I should think some of you may have already come 
across in some fashion or another.  I want to do a search to return a collection of 
objects, but it needs to be very specific as follows:

Example table:
batchnumber | sequence | receive_date | town | item | status
with example values:
"1",1,"11/5/2003","MONTREAL","widget", "INVENTORY"
"1",2,"11/5/2003","MONTREAL","widget", "FRONT"
"1",3,"11/5/2003","MONTREAL","widget", "INVENTORY"
"2",1,"11/5/2003","MONTREAL","foo", "FRONT"
"3",1,"11/5/2003","MONTREAL","bar", "FRONT"
"3",2,"11/5/2003","MONTREAL","bar", "SOLD"
"4",1,"11/5/2003","TORONTO","bar", "FRONT"
"5",1,"11/6/2003","MONTREAL","bar", "INVENTORY"

What I would like is the **last sequence-per-batchnumber** for results based on a 
search.
example psuedo-query:
SELECT OBJECT(o) WHERE ((o.town = "MONTREAL") AND (o.receive_date = "11/5/2003"))
would return:
"1",3,"11/5/2003","MONTREAL","widget", "INVENTORY"
"2",1,"11/5/2003","MONTREAL","foo", "FRONT"
"3",2,"11/5/2003","MONTREAL","bar", "SOLD"

And another psuedo-query:
SELECT OBJECT(o) WHERE (o.item = "bar") 
would return:
"3",2,"11/5/2003","MONTREAL","bar", "SOLD"
"4",1,"11/5/2003","TORONTO","bar", "FRONT"
"5",1,"11/6/2003","MONTREAL","bar", "INVENTORY"

Based on JBoss 3.2.2 and Mysql 3.23, could EJB-QL, JBossQL, or some type of declared 
SQL be able to solve this? An example pretty please!

Thanks everyone!
-D


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to