Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Sybase > Complex query
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 2413 of 2504
Post > Topic >>

Complex query

by usawargamer@[EMAIL PROTECTED] Mar 2, 2008 at 08:47 PM

My dataset looks like this:
2 groups (G1 and G2)  of  4 items each

Group G1 contains
id   value
A1  9
A2  7
B1  3
B2  2


Group G2 contains
id   value
A3  9
A4  7
B2  1
B3  0


I would like a query that returns the item(s) with the lowest value
with the restriction that if taht item is in multiple groups it must
have teh lowest value in each group (or be tied for the lowest)

B2 in group 1 has a value of 2 (the lowest in that group), but its
also in group 2 and has a value (1) that is not the lowest in that
group (even though its lower than in group 1)


The above is a simplification, as there will be several groups, each
with up to 10 items.
There are perhaps 10 groups and 50 items max.

How can I write this query other tahn through a set of while
statements and temp tables taht are iteratively built up?



Thank you for your help
 




 6 Posts in Topic:
Complex query
usawargamer@[EMAIL PROTEC  2008-03-02 20:47:00 
Re: Complex query
ThanksButNo <no.no.tha  2008-03-03 00:17:12 
Re: Complex query
Adam <adam.skinner@[EM  2008-03-14 06:42:33 
Re: Complex query
PDreyer <petrus.dreyer  2008-03-17 05:43:19 
Re: Complex query
Adam <adam.skinner@[EM  2008-03-18 06:48:51 
Re: Complex query
--CELKO-- <jcelko212@[  2008-03-18 09:21:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 0:45:50 CDT 2008.