Click here to Skip to main content
15,917,971 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends,

I'm not sure how to get this please look in to this and help me!


F1 F2 F3 F4
1 1 1 2
2 1 1 2
3 2 2 1
4 2 2 1

Fields----F1 F2 F3 F4


F1 F2 F3 F4
2 1 1 2
4 2 2 1

my code:

SELECT F1,  F2,  F3 , F4
FROM test as A
FROM test as B
WHERE A.F3 = B.F3 )

this code helpful to select but how to improve this code!
Updated 16-Jan-12 5:43am
fjdiewornncalwe 16-Jan-12 11:41am    
Your question really doesn't make sense. Your output data doesn't conform to any potential distinct selection on the provided data set. Please reread your question and update it as required.
visnumca123 16-Jan-12 11:45am    
its not data set its sql query!
Kschuler 16-Jan-12 11:41am    
You need to explain in much more detail what you are trying to do here. Just looking at your table and what you want are not enough. Which fields are you trying to "distinct" on...if it's F2, F3, F4 then how do you know what to pull for F1. You say you want 2 and 4 but why not 1 and 3?

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