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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i fetch a row without using fetch first?

Status
Not open for further replies.

jkmak69

Programmer
Mar 22, 2004
2
US
i am using db2 7.1. i am creating a subquery which returns about 100 results. ex: select zip_code from address where city = 'Los Angeles'. the problem is i only want one result. i can't use fetch first only in a subquery. can someone help me?

thanks,

john
 
Maybe if you posted the whole query, there might be an alternative way to do it? Not too au fait with zip codes, as our post codes zone down to about 6 individual addresses. Does LA have multiple zip codes? In which case, aren't you bothered which one you get returned?

Steve
 
John,
As Steve says in the last post, a bit more information might be required as to what specific row you want out of the 100 returned by the sub query. Would MIN(zipcode) or MAX(zipcode) work at all?

Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top