Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

first and last items

Status
Not open for further replies.

esemerda

Programmer
Feb 24, 2005
3
AU
say i do a select statement and I get 5 record sets returned. each record set has a different number of variables ie.

r1 - xyz123, udf432, asf909, lkj011
r2 - kjf092, sdf092
r3 - dsf025, dsl985, fds986
r4 - sdf021
r5 - dsa349, fds543, xcv941, fiz091, fgs431, oiz012

what i'd like to do, is instead of getting all of the values in each record set, i'd like to only extract the 1st and the last ie.

r1 - xyz123, lkj011
r2 - kjf092, sdf092
r3 - dsf025, fds986
r4 - sdf021
r5 - dsa349, oiz012

Is this possible using 1 sql?
 
I'm not sure to understand correctly, but I guess you may consider the UNION operation.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top