Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


How to limit query results to only 1 row

How to limit query results to only 1 row

How to limit query results to only 1 row

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.


RE: How to limit query results to only 1 row

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close