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

SQL Statement only Returning One Record

Status
Not open for further replies.

carla

Technical User
Jan 9, 2001
39
US
Good Afternoon,

I have the following SQL statement:

'select KA_ID, BUG_ID, CREATED_BY from TABLE_KA where RTRIM(BUG_ID) like '%45627%'

to pull Knowledge Assets out of a Knowledge database where a specific software bug number appears. For bug #45627, there are 5 Knowledge Assets in the database that should be returned. The above statement is only returning one bug # - the first one it comes across.

How can I pull all 5 instances?

Any thoughts are greatly appreciated.
Best Regards,
Carla
 
The query will find all records where the bug_id is like 45627. How do you show the data?

Why do you use like? That type of query you have now will be very slow as it is impossible to use any index. What datatype is bug_id?
 
I actually show the data using a recordset in ASP.

I use 'like' becase all bug ids are preceded by other characters. The last 5 characters (45627) are always unique. Also, there may be more than one bug id in that field. They are separated by spaces.

bug_id is a string.

I suspect there could be some problems with my ASP code, which is obviously not for this forum.
 
I agree, nothing wrong with the query, you could leave out the RTRIM serves no purpose.

How do you know there is only 1 record returned, are you checking the recordcount ? If this is a snapshot type rs this will only show 1 until you fully populate the rs with a movelast. (then a movefirst).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top