Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Using Cursor to return single value

Author  Topic 

cyberbond007
Starting Member

4 Posts

Posted - 2006-10-03 : 06:26:51
Good Day,

urn f_bbk_result
--------------- ------------
1179940 NEGATIVE
1179940 PENDING

Above is a table that returns two values for the same unique key as I used a couple of tables in my joins and this particular record contains two records. Is there a way that I can retain only one record, ie. in this case the pending record? In some instances there could be 3 results for the same identifier.

Basically what I want to do is to retain any record that has a POSITIVE or PENDING result.

Thanks in advance

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-10-03 : 06:30:38
select distinct urn from mytable
where f_bbk_result in ('positive', 'pending')


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-10-03 : 06:31:19
If you want to modify your existing query, you will have to put the query here.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-03 : 08:44:33
Learn SQL

http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2006-10-03 : 09:30:20
so, this COULD return more than one value?

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -