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

How to limit query results to only 1 row

Status
Not open for further replies.

itfellow

MIS
Jan 6, 2004
130
US
Hi there,

I am trying to create a report for use with SQLbase. The query for this report returns a value only if there is at least 1 row in table B that matches the key in table A. However, in some cases, there may be multiple rows in table B that match table A, in which case my query returns multiple identical lines - one for each match in table B.

I would like to have the query return only 1 row regardless of how many matching rows there are in table B. Is there a way in SQLbase to limit the number of rows returned? For example, in other DBs, like SQL server, you can state "limit 1" or something similar in the SQL query to limit the number of returned rows to 1, but I haven't been able to find anything that will do the same in SQLbase.

By the way, for reasons that I won't bore you with, I cannot restructure the entire query, nor would I want to, because the majority of queries work just fine. Only a small number (say 1 in 400) produce this multiple result.

Thanks.
 
In SQL Windows the Report gets the lines based on the Fetch Next and Return TRUE. If you want only record, you can use a boolean variable to set once result is fetched, so it does not fetch more than one time.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top