Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Is it possible to select a distinct column and leave the rest of the column repeating itself. ?

What I have tried:

I don't know whether that could be possible
Posted
Updated 3-Mar-16 9:42am
Comments
OriginalGriff 3-Mar-16 14:33pm    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Perhaps if you show use an example of the data and the output you want it might help?
Use the "Improve question" widget to edit your question and provide better information.
Richmond Boateng 3-Mar-16 14:42pm    
name subject. Scores
Joy. Maths. 50
Joy. Physics. 40
Pen. Maths. 68
Pen. English. 45



Something like this and I wanna select distinct name from "name" and the leave the rest. Am creating a report using Crystal report in vb. And I want each student to have his/her own report.
Like

Fullname : Joy

Subject Scores
Maths. 50
Physics. 40


So when you click on the next button then you see Pen's own like that

ZurdoDev 3-Mar-16 14:37pm    
Not sure what you mean. Can you give an example?
Richmond Boateng 3-Mar-16 14:44pm    
name subject. Scores
Joy. Maths. 50
Joy. Physics. 40
Pen. Maths. 68
Pen. English. 45



Something like this and I wanna select distinct name from "name" and the leave the rest. Am creating a report using Crystal report in vb. And I want each student to have his/her own report.
Like

Fullname : Joy

Subject Scores
Maths. 50
Physics. 40


So when you click on the next button then you see Pen's own like that
ZurdoDev 3-Mar-16 15:12pm    
I don't do reporting so there may be a better way, but I understand that normally you would do this in the report control by grouping on the Name. Your data will be as is and let the report control group it.

1 solution

Seems you want to use WHERE[^] clause instead of DISTINCT[^].

SQL
SELECT a.*
FROM TableName a
WHERE [name] = 'Joy'
 
Share this answer
 
v2
Comments
Richmond Boateng 3-Mar-16 15:54pm    
Thank you
Maciej Los 3-Mar-16 16:06pm    
You're very welcome.
If it was helpful, please accept my solution as an asnwer (green button) to remove the question from unanswered list.
Cheers,
Maciej

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