By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,483 Members | 1,909 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,483 IT Pros & Developers. It's quick & easy.

Simple SQL Problem

trueadvantage
P: 12
I have 1 confusion about query.

I have one data sheet which has students name and their marks.

some of the student has got same marks. I want to find out their names.

e.g.: - A 50
B 40
C 50
D 40
E 60
F 60

I want to make query for this. which will help me to find out the duplicates from that sheet means if i put "50" in a particular field the result should display as "A" "C" (bcoz "A" , "C" has got same marks.)

Please let me know if you have any suggestion or solution

Thanks,
Feb 6 '08 #1
Share this Question
Share on Google+
6 Replies


NeoPa
Expert Mod 15k+
P: 31,186
Please be careful where you post your questions. I found this appended to an unrelated HowTo article (Accessing Field Values in Recordsets).

Admin.
Feb 6 '08 #2

NeoPa
Expert Mod 15k+
P: 31,186
In response to your question, you would use SQL similar to the following (you provide little information so I had to make up my own table and field names):
Expand|Select|Wrap|Line Numbers
  1. SELECT [StudentName], [Mark]
  2. FROM [tblStudent]
  3. WHERE [Mark] In(SELECT [Mark]
  4.                 FROM [tblStudent]
  5.                 GROUP BY [Mark]
  6.                 HAVING Count(*)>1)
Feb 6 '08 #3

trueadvantage
P: 12
In response to your question, you would use SQL similar to the following (you provide little information so I had to make up my own table and field names):
Expand|Select|Wrap|Line Numbers
  1. SELECT [StudentName], [Mark]
  2. FROM [tblStudent]
  3. WHERE [Mark] In(SELECT [Mark]
  4.                 FROM [tblStudent]
  5.                 GROUP BY [Mark]
  6.                 HAVING Count(*)>1)
Hi...

First I Apologize for putting question in Howtos. and Thanks a lot for help. I will try with this query. If again i meet with same problem I will let you know all details about the work which im doin.

Thanks a lot
Feb 7 '08 #4

NeoPa
Expert Mod 15k+
P: 31,186
Not to worry too much.
It's early days and we all make mistakes at the start.

Welcome to TheScripts :)
Feb 7 '08 #5

NeoPa
Expert Mod 15k+
P: 31,186
Ah, I just reminded myself of the whole story with the double-post and all.
Again - no worries. I guess the first post got lost to you as it was posted in the HowTo by mistake.

Click on Subscribed (in blue at top) to find any threads you've been involved in.
Feb 7 '08 #6

NeoPa
Expert Mod 15k+
P: 31,186
This thread now continues in another one (Query Problem).
Feb 9 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.