Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi EveryOne.
Need your help on this. I only want the records which has same cno and same type and different status from following.Please see my required result below. I tried self join but it didn't work.
Cno. Csubno. Type Rid rdate status
111 111-001 A 1234 11/1/2011 DischargeReady
111 111-002 A 1235 11/1/2011 Discharged
222 222-001 B 1444 12/1/2011 Pending
222 222-002 B 1444 12/1/2011 Pending
Required Result.
Cno. Csubno. Type Rid rdate status
111 111-001 A 1234 11/1/2011 DischargeReady
111 111-002 A 1235 11/1/2011 Discharged
Thanks in advance.
Posted
Updated 23-Jul-11 6:02am
v4
Comments
Herman<T>.Instance 27-Jul-11 16:28pm    
it is easier to detect when you share your query with us

1 solution

Something like this?

SQL
SELECT
    [Cno.]
    [Csubno.]
    Type
    Rid
    rdate
    status
FROM {Your_Table_Name}
WHERE
    [Cno.] = [Cno.]
    AND
    [Csubno.] = [Csubno.]
    AND
    status <> status
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900